asp.net - C# Web Forms navigation through pages error -
hello have tried found on internet "cross page postback".i succesfully transfer webform2 previous page null can not receive data webform1. here added webform1.aspx:
<div> <asp:textbox runat="server" id="txttransferid" visible="false"></asp:textbox> <asp:button id="btntransfer" runat="server" postbackurl="~/webform2.aspx"/> </div>
here added webform2.aspx:
<%@ previouspagetype virtualpath="~/webform1.aspx" %>
here added webform2.cs:
protected void page_load(object sender, eventargs e) { if (previouspage != null) { var id= ((textbox)previouspage.findcontrol("txttransferid")).text; } }
i tried server.transfer async pageload time.
code on webform1.cs
protected void btntransfer_click(object sender, eventargs e) { server.transfer("~/webform2.aspx"); }
with webform2.cs code:
protected async void page_load(object sender, eventargs e) { if (!page.ispostback) { if (previouspage != null) { var id=((textbox)previouspage.findcontrol("txttransferid")).text; } var response = await apigetorderdetails(convert.toint32(id),1); dataset ds = (dataset)jsonconvert.deserializeobject(response, (typeof(dataset))); orderdetailgrid.datasource = ds; orderdetailgrid.databind(); } }
with server.transfer succesfully transfer webform2 , previous page not null can receive data webform1 error "system.web.httpexception: 'error executing child request /webform1.aspx
innerexception "invalidoperationexception: httpserverutility.execute blocked while waiting asynchronous operation complete."
at end tried @ webform1 :
protected async void btntransfer_click(object sender, eventargs e) { await task.run(() => server.transfer("~/webform2.aspx")); }
the error went away grid wanted load never loaded.
any ideas please?thanks!
Comments
Post a Comment