Home All Groups Group Topic Archive Search About
Author
25 Jan 2007 11:05 AM
marss
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.

Author
25 Jan 2007 12:00 PM
Milosz Skalecki [MCAD]
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>

--
Milosz


Show quoteHide quote
"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.
>
>
Author
25 Jan 2007 12:41 PM
marss
Milosz wrote:
Show quoteHide quote
> 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>
>
> --
> Milosz
>
>
Thanks a lot.