I want to update a panel that contains image control. I want that only this portion should be updated instead of whole page so i am using AJAX.
I am using this code in my aspx file:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server"><Triggers><asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" /><asp:AsyncPostBackTrigger ControlID="Button3" EventName="Click" /></Triggers><ContentTemplate><asp:Panel ID="Panel1" runat="server" Height="602px" Width="1087px"><asp:Button ID="Button1" runat="server" Text="Remove" onclick="Button1_Click"
Width="70px" /><br /><asp:TextBox ID="TextBox1" runat="server" ReadOnly="True" Width="704px"></asp:TextBox><br /><asp:Image ID="Image1" runat="server" Height="488px" Width="992px" /><br /><br /><asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="<<"
Width="70px" Height="25px" /><asp:Button ID="Button3" runat="server" Height="25px" onclick="Button3_Click"
Text=">>" Width="70px" /></asp:Panel></ContentTemplate></asp:UpdatePanel>My image control and textbox control are changed dynamically from c# code as:
protected void Button2_Click(object sender, EventArgs e)
{
Image1.ImageUrl = li[c].Substring(61);
TextBox1.Text = li[c].Substring(67 + len + 8);
}
protected void Button3_Click(object sender, EventArgs e)
{
Image1.ImageUrl = li[c].Substring(61);
TextBox1.Text = li[c].Substring(67 + len + 8);
}
where c is some counter variable.I am getting an error stating "JavaScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed."
How can I get rid of this error and load images correctly ?