- In a BoundColumn column, the cell always contains a single control. Therefore, you
can use 0 as the index. For example, 0 is the index in the following code:
string ProductName = ((TextBox)e.Item.Cells[3].Controls[0]).Text;
- In a TemplateColumn column, the controls are interspersed with literal controls.
Therefore, the previous blank space makes up a literal control. In this case,
the FindControl method must be used with the ControlID parameter as shown in the following code:Note The ControlID placeholder is the id of the control.
bool Discon=((CheckBox)e.Item.FindControl("ControlID")).Checked;
Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.