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



hey 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

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">
<asp:Label ID="Label2" Text="ee" runat="server"></asp:Label>

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

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)
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