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 :
http://www.c-sharpcorner.com/Code/2003/Jan/AccessDataGridVal.asp
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=hijtbu8qli0rishmm
q4tcg4ub6lla9nr2c%404ax.com&rnum=5&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF
-8%26q%3Dasp.net%2Bdatagrid%2Bfind%2Bcontrol
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=fgsSSx39DHA.1988%
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!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx