473,486 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I get my link button to redirect correctly in ASP.net ?

3 New Member
This problem only occurs in Firefox....

I have a page (page 1) with a link button. The link button uses response.redirect to pass parameters and take me to a second page (page 2) when the lnkButton_click event is fired. Most of the time, the functionality works.

However, if a user clicks any other button on the page and then comes back to page 1 using the browser's back button, the link button redirects to that last page. Meaning, the user is directed to the page that they just returned from using the back button and does not go to where they should go (page 2).

When I step through, I notice that the lnkButton_clink event does not even fire. I do see that some sort of javascript is firing ... Javascript (,,DoPostBack) .... How can I force my lnkbutton to redirect to the correct page when the back button is previously used?
Sep 9 '08 #1
5 4557
shweta123
692 Recognized Expert Contributor
Hi,

You can use one of the following two methods to redirect page using linkbutton control :
1> You should set PostBackUrl property of the LinkButton control in order to redirect to the required page when LinkButton control is clicked.
2> You can write the code in LinkButton1_Click event in order to redirect to the required page.
Sep 9 '08 #2
developApps
3 New Member
I do have code in the click event because I need to pass parameters. The problem is the click event never fires when using Firefox. I click the link button and it automatically defaults back to the page from where the user returned.

Expand|Select|Wrap|Line Numbers
  1. Protected Sub lnkSection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkSection.Click
  2.  
  3.         Dim EmployeeID As String = Request.QueryString("empid")
  4.         Dim UnitID As String = GetUnitID(EmployeeID)
  5.         Response.Redirect("UnitListing.aspx?unitid=" & UnitID & "&empid=" & EmployeeID)
  6.  
  7.     End Sub
  8.  
Sep 9 '08 #3
shweta123
692 Recognized Expert Contributor
Hi,

You should write the code to fire the event lnkSection_Click() on Onclick event of linkbutton. e.g.

<asp:LinkButton ID="LinkButton1" runat="server"
OnClick = "lnkSection_Click" >LinkButton</asp:LinkButton>



Protected Sub lnkSection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkSection.Click

Dim EmployeeID As String = Request.QueryString("empid")
Dim UnitID As String = GetUnitID(EmployeeID)
Response.Redirect("UnitListing.aspx?unitid=" & UnitID & "&empid=" & EmployeeID)
End Sub
Sep 10 '08 #4
developApps
3 New Member
Hi,

You should write the code to fire the event lnkSection_Click() on Onclick event of linkbutton. e.g.

<asp:LinkButton ID="LinkButton1" runat="server"
OnClick = "lnkSection_Click" >LinkButton</asp:LinkButton>



Protected Sub lnkSection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkSection.Click

Dim EmployeeID As String = Request.QueryString("empid")
Dim UnitID As String = GetUnitID(EmployeeID)
Response.Redirect("UnitListing.aspx?unitid=" & UnitID & "&empid=" & EmployeeID)
End Sub

I added the OnClick code but still have the same problem. I am wondering if this is a browser issue. It only occurs with Firefox 3.0 .
Sep 10 '08 #5
shweta123
692 Recognized Expert Contributor
Hi,

Please read

This discussion regarding the problem you are getting.
Sep 11 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1184
by: Douglas Gierow | last post by:
a long time ago, someone asked the question: "I'm using a link button for a Select Button Column in a datagrid. Based on information within the grid I'm doing a response.redirect to a different...
6
3842
by: Rod Snyder | last post by:
I'm trying to set up a page with an asp.net link button that would send a user to a certain page and on page load execute a specific stored procedure tied to the button on the previous page. The...
4
1279
by: Framework fan | last post by:
Hello, Has anyone ever seen this before: Say if you are on "webform1.aspx", and there is a link button on this form with the code response.redirect("webform2.aspx") When you click on the...
0
1441
by: Dailan | last post by:
Hi, I create a tree view. Each node has link button associate with it, which includes add, edit, delete buttons. The way I did is for users who have very low capablity of using computer. Now I...
0
875
by: Mike Moore | last post by:
vb.net web project and the problem I have is that after a session.abandon the link button will not work and/or a response.redirect will not work. Any suggestions?
1
3610
by: GTDriver | last post by:
I'm trying to determine how to create a page with data from the database and I want to use the link button to have the user click on. Once the user clicks on the link button I want to transfer...
1
1894
by: PokerJoker | last post by:
I know you can do it with an ImageButton... but i'm bound by the fact that i'm using a third party control with a link button, i'd really like to get the X and Y coordinates of the control so that...
5
2406
by: Matt | last post by:
Creating Dynamic aspnet link buttons with in user control, Then i use the control on ever page with wraped with master page. I get the url of the link buttons from xml. Parameter from xml also...
0
1193
by: Ty | last post by:
I have a page that has three gridviews on it. In each gridview the first column is a link button representing a Database ID field. What I'm trying to accomplish is to email that page and click on...
0
7100
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
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7126
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
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4865
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.