Update Panel

Last post 02-22-2008 5:39 PM by kirchi. 4 replies.

Sort Posts:

  • Update Panel

    02-21-2008, 2:26 AM
    • Member
      1 point Member
    • frank.pedro
    • Member since 05-20-2007, 2:11 PM
    • Posts 20
    I wanted scrollbars on datagrid so I used an update panel as recommend by another member.  Unlike normal pannel or <div> the update panel doenst loose the row focus when i click on one of the selectbuttons. so this works nicely.  My problem is that I cant get my data on the page to update as usual when a record is selected.  without the pannel it worked fine.  i have my selectionChanged event on my grid, and a method executes when i select one of the buttons.  great.   now i put the grid inside the update pannel, and now i cant get the data to update like they did before.  i set the trigger to the datagrid's id.  must i generate the event or what do i need to make it work like i did before? 
  • Re: Update Panel

    02-21-2008, 5:39 AM
    • Participant
      1,390 point Participant
    • Sam.Dev
    • Member since 12-12-2006, 10:54 AM
    • Lahore,Pakistan
    • Posts 342

    if i m understanding ur problem correctly

    you want to update ur rest of portino after Selection change of the grid event , n ur grid is in update panel

    first thing the area of the page u want to update afetr the seltion of the grid should be in the update panel coz ur rest of the page is

    unawre of the fact that ur grid has fired an event due to partial postback n even may be u are making changes in this event to ur rest of the page

    so botom line is

    put ur area of the page u want to update on the selection change event of the grid in the update panel

    n set it UpdatMode to Conditional ...aslo add a trigger n

    <Triggers>

    <asp:AsyncPostBackTrigger ControlID="Ur Gid ID"= EventName="SelectionChanged" />

    </Triggers>

    anoe afer the seletion change of the grid ur update panel will be updated based on this trigger  i specified earlier.

    dont remove ur first updatepanel tht is for grid.

    it is ok

    hope this helps

    sam

     

    Saima Ghumman
    --Mark the post as Answer if the Post helps you--
  • Re: Update Panel

    02-21-2008, 10:21 PM

    GridView control are not compatible with Update Panel when their EnableSortingAndPagingCallbacks property is set to true. The default is false.

    http://www.asp.net/ajax/documentation/live/overview/UpdatePanelOverview.aspx

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: Update Panel

    02-22-2008, 2:32 AM
    • Member
      1 point Member
    • frank.pedro
    • Member since 05-20-2007, 2:11 PM
    • Posts 20
    I never had a problem with the gridview control...but thanx...
  • Re: Update Panel

    02-22-2008, 5:39 PM
    Answer
    • Contributor
      2,422 point Contributor
    • kirchi
    • Member since 03-07-2007, 2:47 AM
    • Posts 328

    Hi frank.pedro,

    Yes this behavior is because of UpdatePanel,

    For example suppose you have a two controls on the page, gridview, and label,

    lets say gridview is inside UpdatePanel, and label is not.

    now if you trigger asynchronous postback from inside UpdatePanel, ONLY the inner contents of UpdatePanel changes, all the remaining controls that are outside of that panel doesnot refresh, even if you assign then some value/visual representation from the server. This helps AJAX developers to speed up web application, because when server sends a response back to the browser, only inner contents of Update Panels are sent, and not the whole page.

    To solve your issue you simply should place ALL the controls you want to be refreshed inside another UpdatePanels (add as much as needed - the more UpdatePanels means more overhead of deserialising respone in the browser). To refresh that UpdatePanels now you have two options:

    1) Simplest one - just assign the "Always" value to the "UpdateMode" property of the panels - this  says the framework - that these UpdatePanels should be refreshed Always - on every asynchronous postback

    2) More sophisticated - Assign "Conditional" value to the "UpdateMode"property to that UpdatePanels. - In this case the Panels are only refreshed - if control triggered postback from inside them (each control refreshesd it's own Panel). And you have an option of refreshing such a UpdatePanels from the server - jast write this inb code behind: UpdatePanel1.Update();

    Hope this helps

    My blog: http://blog.devarchive.net
    My samples: http://devarchive.net
Page 1 of 1 (5 items)