dimanche 11 janvier 2015

The PageRequestManager cannot be initialized more than once - UpdatePanel - Sharepoint 2013



I am new to Sharepoint 2013, I have created a WebPart using Visual Studio 2013 and Deployed into my site, I have googled lots about this issue but not found any solution.


I am using UpdatePanel and Page postback when I click on button and when i debug the code using IE I got the following issue:



ScriptResource.axd:
throw Error.invalidOperation(Sys.WebForms.Res.PRM_CannotRegisterTwice) The PageRequestManager cannot be initialized more than once



VisualWebPart.ascx:



<asp:ScriptManager runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:LinkButton ID="Button1" runat="server" Text="Button" OnClick="Button1_Click1" />

</ContentTemplate>

</asp:UpdatePanel>


VisualWebPart.ascx.cs:



public partial class VisualWebPart1 : WebPart
{
public VisualWebPart1()
{
}

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
InitializeControl();
}

protected void Page_Load(object sender, EventArgs e)
{
}

protected void Button1_Click1(object sender, EventArgs e)
{
Label1.Text = "My name is Afaaf";
}
}


enter image description here








0 commentaires:

Enregistrer un commentaire