CODEDIGEST
Home » CodeDigest
Search
 

Technologies
 

Get the ScriptManager Object in MasterPage from ContentPage in ASP.Net AJAX
Submitted By Satheesh Babu B
On 2/9/2009 9:04:10 AM
Tags: ASP.Net AJAX,CodeDigest  

Get the ScriptManager Object in MasterPage from ContentPage in ASP.Net AJAX

If we develop ASP.Net AJAX application, we will have the ScriptManager object in the MasterPage instead of every content page. Sometimes, we will get a scenario where we want to access the ScriptManager object from Content page, For example: to add a control that is present external to an UpdatePanel as an asynchronous control.

 

ASP.Net AJAX provides the access to current ScriptManager object of the page through GetCurrent() method that is packed with ScriptManager object.

 

The below code snippet will help us to access the ScriptManager in Master page from content page to add a page control as an asynchronous control. Here, we are adding the button control btnSubmit as an Asynchronous control.

 

protected void Page_Load(object sender, EventArgs e)

    {

        ScriptManager _scriptMan = ScriptManager.GetCurrent(this);

        _scriptMan.RegisterAsyncPostBackControl(this.btnSubmit);

    }

 

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..