Entire Page Postback after 2nd event fired in DetailsView in an UpdatePanel

Last post 10-09-2008 9:42 PM by Cheese Slayer. 3 replies.

Sort Posts:

  • Entire Page Postback after 2nd event fired in DetailsView in an UpdatePanel

    02-06-2007, 10:46 AM
    • Loading...
    • revans04
    • Joined on 02-02-2007, 4:31 PM
    • College Station, TX
    • Posts 5

    I'm doing a small proof of concept for a larger project.  I have a page containing a single placeholder and a script manager.  I am dynamically adding an UpdatePanel, GridView and DetailsView to the UpdatePanel and attempting to handle inserts, edits, and deletes to my dataset without generating full page postbacks.

    I've found that if I add triggers specifically to the DetailsView events, it will not do a full postback on the initial firing of an event.  For instance, I load my page with a grid and detail, I click select on the grid and the details are loaded into the detailsview without posting back.  From this point, if I select another item in the grid, I get an entire page postback.  I have tried adding a trigger for every available event for both the grid and detail views.  Does anyone have any ideas?

    Here's pseudo code, I can post source if necessary:

    Page_Load
          Create And Add UpdatePanel to Placeholder
          Set Properties of UpdatPanel

          Create and add triggers
          Dim trigger As New AsyncPostBackTrigger()
          myUpdatePanel.Triggers.Add(trigger)
          trigger.ControlID = myGridView.UniqueID.ToString
          trigger.EventName = "SelectedIndexChanged"

          Other Events handled:
          RowCancelingEdit
          PageIndexChanged
          PageIndexChanging
          RowCommand
          RowDeleted
          RowDeleting
          RowEditing
          RowUpdated
          RowUpdating
          SelectedIndexChanging

          Create and set Datasource properties and bind Grid

          Create and Add DetailsView, initialize properties
          Add Following Triggers:
          ItemUpdating ItemInserting ModeChanging ItemCommand
          ItemCreated
          ItemDeleted
          ItemDeleting
          ItemInserted
          ItemUpdated
          ModeChanged

          Bind to DataSource
    End Page Load

     Something to note, is that I believe that I have to add the controls and bind to the datasource on every postback because they are being added dynamically.
  • Re: Entire Page Postback after 2nd event fired in DetailsView in an UpdatePanel

    02-07-2007, 9:39 AM
    • Loading...
    • revans04
    • Joined on 02-02-2007, 4:31 PM
    • College Station, TX
    • Posts 5

    I found an answer.  Ultimately I stripped the code back down to the basics and re-created the app.

    I had to disable the viewstate and I made sure to name all of my items and not let the framework generate names.  I think those are the main changes.

  • Re: Entire Page Postback after 2nd event fired in DetailsView in an UpdatePanel

    03-23-2007, 7:21 PM

    Hi

    I am curious as to how you were able to add triggers programmatically. 

    I am having difficulty trying to assign a PostBackTrigger for a control that exists inside a gridview's itemtemplate.

    This is how my control looks like - pretty basic stuff: 

    UpdatePanel
    --- GridView
        --- ItemTemplate
            --- Control

    I guess my question is, at which event am I able to assign the postbacktrigger of the UpdatePanel to point to the control that exists inside the ItemTemplate?

    Trawling through the forums, it seems like a lot of people are having issues with the UpdatePanel.  As for myself, I am still trying to get to grips with its quirks - and there are many ;)

    Anyway, cheers for the help in advance. 
     

  • Re: Entire Page Postback after 2nd event fired in DetailsView in an UpdatePanel

    18 hours, 32 minutes ago

    Would anyone have a response to the above question? I seem to be in the same predicament.

    I have a DropDownList in an Insert Template of a DetailsView. The DDL is bound to a different DataSource than the DetailsView its in and I'm trying to make it update after I used a 2nd detailsview to insert a new row that would otherwise be populated into the DDL's data.

Page 1 of 1 (4 items)
Microsoft Communities
Page view counter