SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a visual web part in which one button and a label inside an update panel. When I run the web part in IE and Firefox it works fine but it does not work in Safari.

My declarative part is:

<asp:UpdatePanel ID="pnlFirst" runat="server">
    <ContentTemplate>
        <asp:Button ID="btnClick" runat="server" OnClick="btnClick_Click" Text="Click Here" />
        <asp:Label ID="lblMsg" runat="server"></asp:Label>
    </ContentTemplate>
</asp:UpdatePanel>

My code is:

int count = 0;
protected void Page_Load(object sender, EventArgs e)
{
    count = Convert.ToInt32(ViewState["count"]);
    CallJavascript();
}

private void CallJavascript()
{
    string script = @"Sys.Browser.WebKit = {}; //Safari 3 is considered WebKit"+
                    @"if( navigator.userAgent.indexOf( 'WebKit/' ) > -1 )"+
                     @"{ Sys.Browser.agent = Sys.Browser.WebKit; Sys.Browser.version = parseFloat( navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);"+
                      @"Sys.Browser.name = 'WebKit';}";
    ScriptManager.RegisterClientScriptBlock(this,GetType(),"Script",script,true);
}

protected void btnClick_Click(object sender, EventArgs e)
{
    lblMsg.Text = "Refresh Value:" + count;
    ViewState["count"] = ++count;
}

I searched over internet for the issue and found this link to troubleshoot the problem. That's why I included CallJavascript() method. But it's not working in my case. I debugged the program and found that the when I click from Safari the button_click does not fire. The control just goes away from page load. What should I do?

share|improve this question

I have a similar problem.

I am testing one thing that might do the trick: Make all your update panels on updatemode=conditional.

This is not working so i will try the second solution in Ali SharePoint answer: UpdatePanel in sharepoint not working in Safari browser

share|improve this answer

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.