I created a page and added some user controls using RAD ajax panel. When i click on a button in the user control, the control sends an AJAX request and reloads the control as per the logic.
But the problem is that every time I do an ajax postback page load event for all the controls gets fired.
Is there a way to avoid it?
5 Answers, 1 is accepted
0

Brian Mains
Top achievements
Rank 1
answered on 06 Jan 2009, 01:55 PM
Hey,
I don't know if this works with Telerik or not, but the ScriptManager control has a property specifying whether the current page process is an async postback process or not. The property for the ScriptManager is: http://www.asp.net/Ajax/Documentation/Live/mref/P_System_Web_UI_ScriptManager_IsInAsyncPostBack.aspx
So you can do:
ScriptManager manager = ScriptManager.GetCurrent(this.Page);
if (manager.IsInAsyncPostBack) { }
I don't know if this works with Telerik or not, but the ScriptManager control has a property specifying whether the current page process is an async postback process or not. The property for the ScriptManager is: http://www.asp.net/Ajax/Documentation/Live/mref/P_System_Web_UI_ScriptManager_IsInAsyncPostBack.aspx
So you can do:
ScriptManager manager = ScriptManager.GetCurrent(this.Page);
if (manager.IsInAsyncPostBack) { }
0

Brian Mains
Top achievements
Rank 1
answered on 06 Jan 2009, 08:27 PM
Hey,
The RadAjaxManager also has an IsAjaxRequest property that is more properly used for partial postback requests too.
RadAjaxManager m = RadAjaxManager.GetCurrent(this.Page);
m.IsAjaxRequest
The RadAjaxManager also has an IsAjaxRequest property that is more properly used for partial postback requests too.
RadAjaxManager m = RadAjaxManager.GetCurrent(this.Page);
m.IsAjaxRequest
0

paramvir
Top achievements
Rank 1
answered on 07 Jan 2009, 04:51 AM
But isn't there any way in which I can pass the information about which part is going under ajax postback and getting that information on server.
0

siva prakash
Top achievements
Rank 1
answered on 31 Jul 2009, 05:25 AM
Hi paramvir
please let me know if you get any solution
please let me know if you get any solution
0

Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 31 Jul 2009, 02:43 PM
I may not be understanding what it is you are trying to do, but my question would be, why is the page_load event firing in your user controls a problem? Ignoring AJAX for a moment, these events fire as part of the normal ASP.net page lifecycle during a postback. If you have particular initialization code you run in the user control page_load event, and you don't want this code run during a postback (ie in response to a button being clicked, or something else that raises a postback), you can wrap this code in a "if not page.ispostback" block. If, instead of a postback, your page initializes an Ajax Request (as a result of an ajaxified control on one of your user controls), then the page_load events of your other controls will fire, but the ispostback block will prevent any of the code within them from executing. Is this not what you want to accomplish?