|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
UpdatePanel, PostbackI have a question concerning UpdatePanel. For example, I have two linkbuttons at the UpdatePanel. I want the Button1 linkbutton to update controls within panel (the TextBox1 control in this case), and the Button2 linkbutton perform redirect to another page. When I click on Button2 it returns a new page content as the result of the asynchronous request. <asp:UpdatePanel ID="up" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:LinkButton ID="Button1" Runat="server">Change textbox</asp:LinkButton> <asp:LinkButton ID="Button2" Runat="server">Redirect to another page</asp:LinkButton> </ContentTemplate> </asp:UpdatePanel> Is there any way to do ordinary postback by means of a control placed on UpdatePanel? For some reason I can't remove Button2 out of the UpdatePanel. Thanks. Hi Mate,
Yes, two ways: 1. Specify which control can cause asynchronous postback <asp:UpdatePanel ID="up" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"/> <asp:LinkButton ID="Button1" Runat="server" Text="Change textbox"/> <asp:LinkButton ID="Button2" Runat="server" Text="Redirect to another page"/> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1"/> </Triggers> </asp:UpdatePanel> 2. Redirect to another page using javascript (use it if you don’t need to post back the page and then redirect) <asp:UpdatePanel ID="up" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"/> <asp:LinkButton ID="Button1" Runat="server" Text="Change textbox"/> <asp:LinkButton ID="Button2" Runat="server" Text="Redirect to another page" OnClientClick="window.location.href = 'anotherpage.aspx'; return false;"/> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1"/> </Triggers> </asp:UpdatePanel> -- Show quoteHide quoteMilosz "marss" wrote: > Hello, > I have a question concerning UpdatePanel. > For example, I have two linkbuttons at the UpdatePanel. I want the > Button1 linkbutton to update controls within panel (the TextBox1 > control in this case), and the Button2 linkbutton perform redirect to > another page. When I click on Button2 it returns a new page content as > the result of the asynchronous request. > > <asp:UpdatePanel ID="up" runat="server"> > <ContentTemplate> > <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> > <asp:LinkButton ID="Button1" Runat="server">Change > textbox</asp:LinkButton> > <asp:LinkButton ID="Button2" Runat="server">Redirect to another > page</asp:LinkButton> > </ContentTemplate> > </asp:UpdatePanel> > > Is there any way to do ordinary postback by means of a control placed > on UpdatePanel? For some reason I can't remove Button2 out of the > UpdatePanel. > > Thanks. > > Milosz wrote:
Show quoteHide quote > Hi Mate, Thanks a lot.> > Yes, two ways: > 1. Specify which control can cause asynchronous postback > <asp:UpdatePanel ID="up" runat="server"> > <ContentTemplate> > <asp:TextBox ID="TextBox1" runat="server"/> > <asp:LinkButton ID="Button1" Runat="server" Text="Change textbox"/> > <asp:LinkButton ID="Button2" Runat="server" Text="Redirect to another > page"/> > </ContentTemplate> > <Triggers> > <asp:AsyncPostBackTrigger ControlID="Button1"/> > </Triggers> > </asp:UpdatePanel> > > 2. Redirect to another page using javascript (use it if you don't need to > post back the page and then redirect) > <asp:UpdatePanel ID="up" runat="server"> > <ContentTemplate> > <asp:TextBox ID="TextBox1" runat="server"/> > <asp:LinkButton ID="Button1" Runat="server" Text="Change textbox"/> > <asp:LinkButton ID="Button2" Runat="server" Text="Redirect to another > page" OnClientClick="window.location.href = 'anotherpage.aspx'; return > false;"/> > </ContentTemplate> > <Triggers> > <asp:AsyncPostBackTrigger ControlID="Button1"/> > </Triggers> > </asp:UpdatePanel> > > -- > Milosz > >
How to know the selected row in a DataControlField
Validation Groups and Wizard step DetailsView Default Mode Why does OnClick event not work in 2.0 for DataGrid site maps & menu control Customising the CatalogZone class Why doesn't work DataFormatString for GridView.BoundField ? tie ENTER to a button? Checkboxlist Question web control with GDI+ and MouseMovements. |
|||||||||||||||||||||||