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" <>
> Sender: "vijaya" <>
> Subject: binding data to header
> Date: Tue, 18 Nov 2003 03:54:34 -0800
> Lines: 9
> Message-ID: <081701c3adca$bbbdc100$>
> 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.
>
>