Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Daniel #1
how to find control in ItemTemplate of datagrid
hi,
I had a linkbutton control in ItemTemplate, but i don't know how to find
it. Shall i use findcontrol?
~thanks.
--
Using Opera's revolutionary e-mail client: [url]http://www.opera.com/m2/[/url]
Daniel Guest
-
Find Control in Datagrid
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... -
Datagrid with textboxes on itemtemplate
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... -
datagrid itemtemplate help
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... -
ItemCommand not firing w/ a control in ItemTemplate column
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,... -
DataGrid OnItemBound find control
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
Hi Daniel,
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,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
TextBox txt = (TextBox)e.Item.Cells[2].FindControl("txtSub");
Response.Write("<br>" + txt.ClientID +" | " + txt.UniqueID );
}
}
And here are some other webreouces dicusssing on this :
[url]http://www.c-sharpcorner.com/Code/2003/Jan/AccessDataGridVal.asp[/url]
[url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=hijtbu8qli0rishmm[/url]
q4tcg4ub6lla9nr2c%404ax.com&rnum=5&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF
-8%26q%3Dasp.net%2Bdatagrid%2Bfind%2Bcontrol
[url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=fgsSSx39DHA.1988%[/url]
40cpmsftngxa07.phx.gbl&rnum=16&prev=/groups%3Fq%3Dasp.net%2Bdatagrid%2Brefer
ence%2Bcontrol%26hl%3Den%26lr%3D%26ie%3DUTF-8%26start%3D10%26sa%3DN
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
[url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
Steven Cheng[MSFT] Guest



Reply With Quote

