For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > May 2008 > GridView & OnRowUpdating & no control from EditItemTemplate









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author GridView & OnRowUpdating & no control from EditItemTemplate
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?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com