Ask a Question related to ASP.NET Data Grid Control, Design and Development.
- Daniel #1
how to find control in ItemTemplate of datagrid
I had a linkbutton control in ItemTemplate, but i don't know how to find
it. Shall i use findcontrol?
Using Opera's revolutionary e-mail client: [url]http://www.opera.com/m2/[/url]
- Hi, I have a datagrid and I'm wanting to access one of the hyperlinks which is located in Template Column i.e. <asp:TemplateColumn...
- Hello I have datagrid that by defect in a column of itemtemplate I place textbox. The application is of the goals of a soccer game Then it appears...
- Dear All, In my datagrid, i want to add a logic to it. that is, if the result for the data equals to "Yes", a "asp:label" control will be...
- I 've been dealing with this problem for a while now. I have a datagrid in which one column is a template column, encompassing textboxes (1 hidden,...
- Fixed it, the first item received in the onItemBound event is the datagrid header, this doesn't contain the button. I just have to ensure that I...
- Steven Cheng[MSFT] #2
RE: how to find control in ItemTemplate of datagrid
As for how to retrieve a control in the DataGrid's ItemTemplate, you can
just use the FindControl method. First, get the reference to the certain
DataGridItem, then, use FindControl method on the proper Cell( which
contains the control). For example, here is a code snippet on find a
TextBox control in the datagrid's ItemDataBound event
private void dgMain_ItemDataBound_1(object sender,
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
TextBox txt = (TextBox)e.Item.Cells.FindControl("txtSub");
Response.Write("<br>" + txt.ClientID +" | " + txt.UniqueID );
And here are some other webreouces dicusssing on this :
Microsoft Online Support
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
Get Preview at ASP.NET whidbey
Steven Cheng[MSFT] Guest