I have the following ASPX:
<asp:GridView ID="ctlAllocations" runat="server"
OnRowEditing="ctlAllocations_OnRowEditing"
OnRowDeleting="ctlAllocations_OnRowDeleting"
OnRowCancelingEdit="ctlAllocations_OnRowCancelingE dit"
OnRowUpdating="ctlAllocations_OnRowUpdating"
OnRowUpdated="ctlAllocations_OnRowUpdated"
OnRowDataBound="ctlAllocations_OnRowDataBound" >
<Columns>
<asp:TemplateField HeaderText="GL Account" >
<ItemTemplate><%# DataBinder.Eval(Container.DataItem,
"gldescr")%></ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ctlGLAccountInGrid" runat="server"
DataTextField="Descr" DataValueField="Acct"/>
</EditItemTemplate>
<asp:CommandField ShowEditButton=true CausesValidation=false />
This is the handler for OnRowUpdating
Code:
--------------------
protected void ctlAllocations_OnRowUpdating(object sender, GridViewUpdateEventArgs e)
{
DropDownList ctl1 = (DropDownList)ctlAllocations.Rows[e.RowIndex].Cells[0].FindControl("ctlGLAccountInGrid");
}
--------------------
When it is raised ctl1 == null. Why?
--
senglory
------------------------------------------------------------------------
Posted via
http://www.codecomments.com
------------------------------------------------------------------------