| senglory 2008-05-28, 2:37 pm |
| I have the following ASPX:
<asp:GridView ID="ctlAllocations" runat="server"
OnRowEditing="ctlAllocations_OnRowEditing"
OnRowDeleting="ctlAllocations_OnRowDeleting"
OnRowCancelingEdit="ctlAllocations_OnRowCancelingEdit"
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? |