473,388 Members | 1,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

UpdatePanel, Postback

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.

Jan 25 '07 #1
2 11178
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
"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.

Jan 25 '07 #2

Milosz wrote:
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.

Jan 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jobo | last post by:
I have a news section of the website contained within the updatepanel. What I want is that when a news summary is clicked, the news item opens up in that same box. I thought I wired everything up...
2
by: Jl_G_0 | last post by:
I have a form with ALL my controls on an updatepanel, but theres one giving me a hard time, its an asp:FileUpload control. All I want to do is: - Click on a LinkButton <- WORKS - Open a...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
2
by: John Grandy | last post by:
Is anyone finding that cookies added to the Response.Cookies collection within pages which contain an UpdatePanel do not exist in the Request.Cookies collection when the page is posted back ? ...
3
by: JacekDr | last post by:
Hello, I've got the following problem: I want to add and remove dynamically controls to UpdatePanel. In my user control I have a button, but when I click it I get AsyncPostback and Event for...
1
by: abellix | last post by:
An updatepanel contains a datagrid, this datagrid has columns generated by code-behind: some columns should have async postback, others should have sync postback. Here a sample to reproduce the...
5
by: Leon Mayne | last post by:
Having a bit of trouble here. I know that if you want to use a fileupload control inside an AJAX update panel then you need to create a trigger for the control that performs the uploading postback...
2
by: Mike Gleason jr Couturier | last post by:
Hi guys, I know that the page is reconstructed every time whenever an asynch postback is occuring... I've put a breakpoint in the page render method and the function still gets called when the...
3
by: =?Utf-8?B?Y21lZWsxXzE5OTk=?= | last post by:
Hello, On a webpage, create an UpdatePanel with two DropDownLists. Set AutoPostBack of DropDownList1 to true. In the SelectedIndexChanged method, refill DropDownList2 and set the focus to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.