Search code examples
c#htmlajaxupdatepaneldatapager

How to avoid UpdatePanel getting refreshed on ListView "OnPagePropertiesChanging"


I have a web page with an UpdatePanel. One div inside the panel has a listview of products. Other div has Filters to refine the products. Now on page_load i bind the data on listview and on $(document).ready I make a jQuery Ajax call which updates the Filters Div.

Now it works fine till here. I can click on those filters which refines the products listview( though another Ajax call ). The problem start when i add a datapager to the listview.

When i click on the next page it updates the products listview with next page of products but my filters get wiped out and the '$(document).ready'doesnt get called. is it possible to execute my ajax call on page_properties changing?


Solution

  • Try to use: Sys.Application.add_load(function () { instead of $(document).ready. The first one is triggered also when only the Update Panel updates. References: https://msdn.microsoft.com/en-us/library/vstudio/bb383829%28v=vs.100%29.aspx