Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   binding data to header (http://www.velocityreviews.com/forums/t756110-binding-data-to-header.html)

vijaya 11-18-2003 11:54 AM

binding data to header
 
Can we bind data to textbox in a headertemplate in a
template column of a datagrid?

I've tried with text box and table. But I couldn't
succeeed.

If aanyone has tried it,please help me out.Please give
some code snippets.


Mike Moore [MSFT] 11-18-2003 10:45 PM

RE: binding data to header
 
Hi Vijaya,

The basic idea is to use the grid's ItemDataBound event. Here's an example.

Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
If (e.Item.ItemType = ListItemType.Header) Then
CType(e.Item.Cells(1).FindControl("Button1"),
WebControls.TextBox).Text = "hello"
End If
End Sub

However, my example uses static text, "hello". You can write an entire
database selection function here in this event. Another option is to walk
through your dataset before closing it and storing the desired value in a
global variable for later use here. In any case, ItemDataBound is the place
to do it.

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.


--------------------
> Content-Class: urn:content-classes:message
> From: "vijaya" <anonymous@discussions.microsoft.com>
> Sender: "vijaya" <anonymous@discussions.microsoft.com>
> Subject: binding data to header
> Date: Tue, 18 Nov 2003 03:54:34 -0800
> Lines: 9
> Message-ID: <081701c3adca$bbbdc100$a501280a@phx.gbl>
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: 7bit
> X-Newsreader: Microsoft CDO for Windows 2000
> Thread-Index: AcOtyru96kpxNUxZRSuracij1nHAGQ==
> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
> Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
> Path: cpmsftngxa06.phx.gbl
> Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet.buildingc ontrols:8163
> NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
> X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
>
> Can we bind data to textbox in a headertemplate in a
> template column of a datagrid?
>
> I've tried with text box and table. But I couldn't
> succeeed.
>
> If aanyone has tried it,please help me out.Please give
> some code snippets.
>
>




All times are GMT. The time now is 05:23 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.