Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Programatically setting a HeaderTemplate HeaderText.

Reply
Thread Tools

Programatically setting a HeaderTemplate HeaderText.

 
 
Andy
Guest
Posts: n/a
 
      05-25-2004
I am trying to set the header text of a datagrid at run time using the
following code
<asp:TemplateColumn HeaderText="">
<HeaderTemplate>
<asp:HyperLink id="hlLink"
runat="server"></asp:HyperLink>="<%sHeadingString%>
</HeaderTemplate>

This doesn't work. And I can't seem to get to the object in code in
the code behind page using something like
dgLibraryView.Columns(0).hlLink.Text= sHeadingString

Any ideas?

Thanks.
 
Reply With Quote
 
 
 
 
Amar
Guest
Posts: n/a
 
      05-26-2004
You should override ItemCreated event of Grid and write everything you
want at each cell

protected override void OnItemCreated(DataGridItemEventArgs e) {

if (e.Item.ItemType == ListItemType.Header){
for(int i=0;i<e.Item.Cells.Count;i++){
e.Item.Cells[i].Text = ........
}
}
}


http://www.velocityreviews.com/forums/(E-Mail Removed) (Andy) wrote in message news:<(E-Mail Removed). com>...
> I am trying to set the header text of a datagrid at run time using the
> following code
> <asp:TemplateColumn HeaderText="">
> <HeaderTemplate>
> <asp:HyperLink id="hlLink"
> runat="server"></asp:HyperLink>="<%sHeadingString%>
> </HeaderTemplate>
>
> This doesn't work. And I can't seem to get to the object in code in
> the code behind page using something like
> dgLibraryView.Columns(0).hlLink.Text= sHeadingString
>
> Any ideas?
>
> Thanks.

 
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
how to find control in headertemplate of datagrid Cheng ASP .Net 2 11-14-2007 03:57 PM
Setting text in HeaderTemplate, how?? Jeff ASP .Net 8 03-13-2007 12:05 AM
DataGrid HeaderTemplate Question Ashish Sharma ASP .Net 0 04-14-2004 08:07 PM
Can we bind data to textbox in a headertemplate of a datagrid Vijaya ASP .Net 2 11-13-2003 06:42 AM
How do you access controls in the HeaderTemplate of a DataGrid SamIAm ASP .Net 1 06-26-2003 09:04 AM



Advertisments