473,549 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ 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.redire ct 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 4566
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_Cli ck 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_Clic k() on Onclick event of linkbutton. e.g.

<asp:LinkButt on ID="LinkButton1 " runat="server"
OnClick = "lnkSection_Cli ck" >LinkButton</asp:LinkButton>



Protected Sub lnkSection_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles lnkSection.Clic k

Dim EmployeeID As String = Request.QuerySt ring("empid")
Dim UnitID As String = GetUnitID(Emplo yeeID)
Response.Redire ct("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_Clic k() on Onclick event of linkbutton. e.g.

<asp:LinkButt on ID="LinkButton1 " runat="server"
OnClick = "lnkSection_Cli ck" >LinkButton</asp:LinkButton>



Protected Sub lnkSection_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles lnkSection.Clic k

Dim EmployeeID As String = Request.QuerySt ring("empid")
Dim UnitID As String = GetUnitID(Emplo yeeID)
Response.Redire ct("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
1187
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 page. However, I'd like to open a new window. How is this done?" i had the same problem so here's my fix: add a hidden input variable to the...
6
3850
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 link would be in a nav area and be something like "update". It would send the user to the main page and execute the stored procedure associated with...
4
1282
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 button, you just simply stay where you are (on webform1.aspx). You just don't move to the next page. The screen goes white, and you get completely...
0
1445
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 encoutered problem. At certain situation the event does not fire when I click my link button. I generate my tree and link button on fly, and associate...
0
882
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
3621
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 them to another page, passing, for example, the customer id from my database. How to I create a url for this link button, that includes the page name...
1
1899
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 i can position a pop over div appropriately on the click (using ajax). Thanks! -Justin
5
2409
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 Builing Dynamicly link buttons with url's works fine. The problem is when i click the buttons they First link button and second link button works third...
0
1197
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 the link button to open the page. The problem. When I send the page to myself on the same PC that I am creating the site on and open the email...
0
7527
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7459
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7967
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7819
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5097
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1953
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 we have to send another system
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
772
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.