Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a web part in which I have placed an update panel. To use this web part in the Safari browser there is an issue that the whole page is refreshed instead partial page rendering. The same web part executed perfectly in IE and Firefox. I got the solution to this that by settingn the property EnablePartialRendering to false the update panel works perfectly in Safari.

Now as the Script Manager is already added in the MasterPage i.e. seattle.master in SharePoint I want to access it programmatically and check if the request has come from Safari then change the EnablePartialRendering property of ScriptManager to false.

How do I change the property of ScriptManager which is included in the MasterPage.

My code is:

int count = 0;
protected void Page_Load(object sender, EventArgs e)
{   
    count = Convert.ToInt32(ViewState["count"]);
    if (Page.Request.Browser.Type.ToUpper().Contains("SAFARI"))
    {
        /* I want to change the value of ScriptManager here.. */
    }
}                
protected void btnClick_Click(object sender, EventArgs e)
{
    lblMsg.Text = "Refresh Value:" + count;
    ViewState["count"] = ++count;            
}

What should I do?

share|improve this question

2 Answers 2

Got the answer by testing workarounds.

Just I need to write some lines of code in the OnInit() method of form.

if (Page.Request.Browser.Type.ToUpper().Contains("SAFARI"))
{
    ScriptManager sm = ScriptManager.GetCurrent(this.Page);
    if (sm != null)
    {
        sm.EnablePartialRendering = false;
    }
}

Anything for ScripManger cannot be changed after OnInit() method that's why it is must to place the code in OnInit() and this works fine.

Hope this helps others too!!

share|improve this answer

Use the below code to get the instance of the Script manager applied in that page,

ScriptManager sm =ScriptManager.GetCurrent(this.Page);
share|improve this answer
    
I changed my code like: if (Page.Request.Browser.Type.ToUpper().Contains("SAFARI")) { ScriptManager sm = ScriptManager.GetCurrent(this.Page); if (sm != null) { sm.EnablePartialRendering = false; } } And after deploying the solution it runs perfectly in FireFox but the error is thrown in the SAFARI –  users1100 Feb 4 at 12:57
    
Am I following the right way to change the property of sm object? –  users1100 Feb 4 at 12:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.