The Update method can only be called on UpdatePanel with ID 'UpdatePanel1' before Render.|

J

Jeff

hey

asp.net 3.5

I have 2 UpdatePanels in my webpage. This webpage has a GridView, which one
of its column is a templatefield which again contain a UpdatePanel and a
button...

The other UpdatePanel is located outside the GridView....

when I click on the button in the GridView I get this error message:
The Update method can only be called on UpdatePanel with ID 'UpdatePanel1'
before Render.

here is the markup of the UpdatePanel which is located outside GridView:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label2" Text="ee" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>

Here is the markup of the UpdatePanel inside the GridView:
<asp:TemplateField>
<ItemTemplate>
<asp:UpdatePanel runat="server" UpdateMode="Conditional"
ChildrenAsTriggers="false">
<ContentTemplate>
<asp:ImageButton ID="ibSelect" ImageUrl="~/Images/ArrowR.gif"
OnCommand="ibSelect_Command" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>

Here is the code-behind methods being called by the markup above:
protected void ibSelect_Command(object sender, CommandEventArgs e)
{
string url = "<url>";
WebRequest request = WebRequest.Create( url +
e.CommandArgument.ToString() );
request.BeginGetResponse(new AsyncCallback(OnResponse), request);
}


protected void OnResponse(IAsyncResult ar)
{
WebRequest request = (WebRequest)ar.AsyncState;
WebResponse response = request.EndGetResponse(ar);
System.IO.Stream stream = response.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(stream);
string line;
System.Text.StringBuilder html = new System.Text.StringBuilder(40);
while ((line = reader.ReadLine()) != null)
{
html.Append(line);
}
Label2.Text = html.ToString();
UpdatePanel1.Update(); <<---------- here the program stops
executing and I get the error
}

any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top