S
srini.venkatesan
I am trying to access a control from edititemtemplate in itemdatabound
event, but I get a run time null reference exception.
Class file :
In Datagrid_update I am able to access with no issues.
DataGridItem item = DataGrid2.Items[DataGrid2.EditItemIndex];
string test= ((TextBox) item.Cells[2].FindControl("xxx")).Text;
In DataGrid2_ItemDataBound , the following line gives me a run time
exception
string test1= ((TextBox) e.Item.Cells[2].FindControl("xxx)).Text;
Part of html:
<asp:TemplateColumn HeaderText="TotalTest">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Totalx") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="xxx" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Totalx") %>' />
</EditItemTemplate>
</asp:TemplateColumn>
Is edititemtemplate is not accessible from itemdatabound ? Any help is
appreicated.
event, but I get a run time null reference exception.
Class file :
In Datagrid_update I am able to access with no issues.
DataGridItem item = DataGrid2.Items[DataGrid2.EditItemIndex];
string test= ((TextBox) item.Cells[2].FindControl("xxx")).Text;
In DataGrid2_ItemDataBound , the following line gives me a run time
exception
string test1= ((TextBox) e.Item.Cells[2].FindControl("xxx)).Text;
Part of html:
<asp:TemplateColumn HeaderText="TotalTest">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Totalx") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="xxx" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Totalx") %>' />
</EditItemTemplate>
</asp:TemplateColumn>
Is edititemtemplate is not accessible from itemdatabound ? Any help is
appreicated.