GridView & OnRowUpdating & no control from EditItemTemplate

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • senglory

    GridView & OnRowUpdating & no control from EditItemTemplate


    I have the following ASPX:

    <asp:GridView ID="ctlAllocati ons" runat="server"
    OnRowEditing="c tlAllocations_O nRowEditing"
    OnRowDeleting=" ctlAllocations_ OnRowDeleting"
    OnRowCancelingE dit="ctlAllocat ions_OnRowCance lingEdit"
    OnRowUpdating=" ctlAllocations_ OnRowUpdating"
    OnRowUpdated="c tlAllocations_O nRowUpdated"
    OnRowDataBound= "ctlAllocations _OnRowDataBound " >
    <Columns>
    <asp:TemplateFi eld HeaderText="GL Account" >
    <ItemTemplate>< %# DataBinder.Eval (Container.Data Item,
    "gldescr")% ></ItemTemplate>
    <EditItemTempla te>
    <asp:DropDownLi st ID="ctlGLAccoun tInGrid" runat="server"
    DataTextField=" Descr" DataValueField= "Acct"/>
    </EditItemTemplat e>
    <asp:CommandFie ld ShowEditButton= true CausesValidatio n=false />


    This is the handler for OnRowUpdating


    Code:
    --------------------


    protected void ctlAllocations_ OnRowUpdating(o bject sender, GridViewUpdateE ventArgs e)
    {
    DropDownList ctl1 = (DropDownList)c tlAllocations.R ows[e.RowIndex].Cells[0].FindControl("c tlGLAccountInGr id");
    }


    --------------------


    When it is raised ctl1 == null. Why?



    --
    senglory
    ------------------------------------------------------------------------
    Posted via http://www.codecomments.com
    ------------------------------------------------------------------------

Working...