Update/Insert/Delete with DataSourcePersistenceMode = NoPersistence

3 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 30 Mar 2007 Link to this post


    RadGrid for ASP .NET version

    RadControls for ASP .NET AJAX version

    4.x and later

    2008.1.415 and later

    .NET version

    2.0 and later

    Visual Studio version

    2005 and later

    Programming language


    Browser support

    all supported by RadGrid for ASP .NET

    all browsers supported by RadControls for ASP .NET AJAX

    Note: With Telerik.Web.UI 2007.12.18+ or version 5.x of RadGrid/later you should set the EnableViewState property of the grid to false. DataSourcePersistenceMode is obsolete property and is excluded from the Prometheus version of RadGrid.

    The project in this post demonstrates how to perform update/insert/delete when the EnableViewState property of the grid is set to false (light-weight grid viewstate persistence). In such mode the control event sequence is a bit different and the update/insert logic needs to be executed on NeedDataSource having some additional checks.

    Keep in mind that the mode with switched off viewstate has some additional limitations which are discussed in detail in these online resources:

    EnableViewState = false

    Optimizing viewstate usage
  2. Alfa
    Alfa avatar
    7 posts
    Member since:
    Jan 2005

    Posted 12 Oct 2009 Link to this post


    I run this demo UpdateInsertDeleteWithDisabledViewState_Web_UI.zip . When press cancel button on edtiform anyway insert record.

    What can i do?

  3. Sebastian
    Sebastian avatar
    9934 posts

    Posted 15 Oct 2009 Link to this post

    Hello Francisso,

    Indeed you are right - in this case the edit/insert operation will be processed regardless whether you press the Cancel button or not due to the specific event sequence when the viewstate of RadGrid is disabled.

    The only option I can offer you is to remove the cancel button from the edit/insert form (thus disabling the cancel option) intercepting the ItemCreated event of the control, namely:

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        if(e.Item is GridEditableItem && e.Item.IsInEditMode)
            e.Item.FindControl("CancelButton").Visible = false;

    I hope this is feasible for your situation.

    Best regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.