Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to find control in headertemplate of datagrid

Reply
Thread Tools

how to find control in headertemplate of datagrid

 
 
Cheng
Guest
Posts: n/a
 
      02-29-2004
hi
i have adding a label in the headertemplate of a datagrid
i have write the code to find it;

//my code
Label lbl = (Label) DataGrid1.FindControl("myLabel");

but i can't find it
what is the right method that i can find it?

thank you



 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3VyZXNo?=
Guest
Posts: n/a
 
      02-29-2004
Try iterating thru the DataGridItems in your datagrid and use the DataGridItem.FindControl("idofyourcontrol") method to find your label control.

Suresh

----- Cheng wrote: ----

h
i have adding a label in the headertemplate of a datagri
i have write the code to find it

//my cod
Label lbl = (Label) DataGrid1.FindControl("myLabel")

but i can't find i
what is the right method that i can find it

thank you :




 
Reply With Quote
 
 
 
 
dany7487 dany7487 is offline
Junior Member
Join Date: May 2007
Posts: 2
 
      11-14-2007
I think the solution to access controls inside the headertemplate is:

ctr = grid1.HeaderRow.FindControl("ckbCheckAll");
if (ctr is CheckBox)
{
(ctr as CheckBox).Checked = true;
}

hope this helps,
Daniel.
 
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
controlling button in headertemplate datagrid JoNa SuperGold ASP .Net 1 04-05-2005 10:02 PM
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
Can we bind data to textbox in a headertemplate of a datagrid Vijaya ASP .Net Building Controls 1 11-12-2003 07:52 PM
How do you access controls in the HeaderTemplate of a DataGrid SamIAm ASP .Net 1 06-26-2003 09:04 AM



Advertisments