GridView inside DataList is not raising RowEdit events

Last post 04-02-2007 3:18 AM by Rex Lin - MSFT. 2 replies.

Sort Posts:

  • GridView inside DataList is not raising RowEdit events

    03-29-2007, 4:58 PM
    • Loading...
    • stevet7717
    • Joined on 02-02-2006, 11:57 PM
    • Benicia, California
    • Posts 18

    I have a DataList bound to an ObjectDataSource. In the ItemTemplate of the DataList I have a GridView and another ObjectDataSource (bound to a different business object than the DataList's data source). I set the inner ObjectDataSource Select parameter from the DataList's DataItem during the ItemDataBound event. The effect is a list of grids.

    The GridViews have an Edit column. When I click the edit button the row goes into edit mode and the RowEditing event fires.But when I click Update nothing happens: the row stays in edit mode and neither the RowUpdating nor RowUpdated events are raised. If I click Cancel the RowCancelingEdit event fires and the row returns to its normal state.

     If I put a GridView and ObjectDataSource outside the DataList everything works exactly as expected. It's only when they are inside the DataList that I updating doesn't work.

    How can I edit a GridView inside a DataList?

    Thanks

    Filed under: ,
  • Re: GridView inside DataList is not raising RowEdit events

    03-30-2007, 1:39 PM

    hi

    Sinnce u are using the gridview inside the datalist u will not able to call the event handlers of the gridview in the codebehind file..

    instead u can try this ..

    In the .aspx page where u declare the grid view  

     <asp:GridView ID=""  runat="server"  OnRowEditing="MethodName1" OnRowUpdated="Methodname2" OnRowUpdating="Methodname3">

    </asp:gridView> 

    in the  code behind File

    protected sub methodname1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs

    end sub

     

    protected sub methodname2(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs

    end sub

    protected sub methodname3(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs

    end sub

     write the corroesponding code here..

    hope this will help

     

     

     

    |__Roshan__|
  • Re: GridView inside DataList is not raising RowEdit events

    04-02-2007, 3:18 AM
    Answer

    Dear, friend:

    Make sure you have set the updatecommand in datasource and datekey in GridView correctly.

    I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance

    Best Regards,
    __________________________________________________
    Sincerely,
    Rex Lin
    Microsoft Online Community Support

    If there is any question or the issue is not resolved, please feel free to mark the thread as not resolved
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter