Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > binding data to header

Reply
Thread Tools

binding data to header

 
 
vijaya
Guest
Posts: n/a
 
      11-18-2003
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.

 
Reply With Quote
 
 
 
 
Mike Moore [MSFT]
Guest
Posts: n/a
 
      11-18-2003
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" <(E-Mail Removed)>
> Sender: "vijaya" <(E-Mail Removed)>
> Subject: binding data to header
> Date: Tue, 18 Nov 2003 03:54:34 -0800
> Lines: 9
> Message-ID: <081701c3adca$bbbdc100$(E-Mail Removed)>
> 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.
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
GridView binding - how to stop initial binding Amit ASP .Net 6 10-24-2006 08:06 AM
Binding data to datagrid header template on button click Santosh ASP .Net 0 08-04-2006 04:57 AM
Complex data binding question, binding child objects of a custom collection. JcFx ASP .Net Datagrid Control 0 06-01-2005 04:01 PM
Data Binding - using inline code vs. functions vs. straight binding Jordan ASP .Net 2 02-10-2004 08:32 PM



Advertisments