473,799 Members | 3,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp hyperlink click event?

I have an asp:hyperlink that I need to have some code fire when the link is
clicked. The link is in a datagrid and the link is working properly. I tried
using the OnInit event to call the subroutine but that fires when the
control is rendered. I need the code to fire only when the users clicks on
one of the links in the datagrid.

Any help would be appreciated,
Doug
Nov 18 '05 #1
2 7981
asp:hperlink emits a pure <a href > and doesnt have any server side events
based on my experience (can be wrong)

if you need to execute server side code then use linkButton... this cause a
postback on click and you can do all you want

HTH

HD

"Doug Stiers" <st****@email.c om> wrote in message
news:OO******** ******@TK2MSFTN GP11.phx.gbl...
I have an asp:hyperlink that I need to have some code fire when the link is clicked. The link is in a datagrid and the link is working properly. I tried using the OnInit event to call the subroutine but that fires when the
control is rendered. I need the code to fire only when the users clicks on
one of the links in the datagrid.

Any help would be appreciated,
Doug

Nov 18 '05 #2
Hi, Doug,

ASP:Hyperlink doesn't have a server Click event. Init
event occurs when the server control is initialized, which
is the first step in the its lifecycle. This is fired even
before it is rendered.
If you need a server Click event, use LinkButton in stead.
If you need a client onclick event, do like the following:
Hyperlink1.Attr ibutes("onclick ") = "javascript:ale rt('The
hyperlink is clicked!');"

Bin Song, MCP

-----Original Message-----
I have an asp:hyperlink that I need to have some code fire when the link isclicked. The link is in a datagrid and the link is working properly. I triedusing the OnInit event to call the subroutine but that fires when thecontrol is rendered. I need the code to fire only when the users clicks onone of the links in the datagrid.

Any help would be appreciated,
Doug
.

Nov 18 '05 #3

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

Similar topics

1
1298
by: ashoo | last post by:
Guys! I am trying to use a dropdownlist click event in my header page to link to my main page in a frameset type of form. I try to link to my main page with a hyperlink control.It works fine. But I would like to use the click event of my dropdownlist to do the samething. so I thought if could trigger the clik event of the hyperlink within my dropdownlist click event it could work. But I am not sure how to set it up.
4
13464
by: | last post by:
Does anyone know how to trigger the click event of a hyperlink control programmatically? Thanks for helping.
2
1785
by: Big E | last post by:
I'm using ASP.Net and SQL Server. I have a table called states. I have 2 forms. On form 1 is the 50 states in textboxes created with a loop. I want to have those 50 or 45 or whatever amount of states have a hyperlink. Once you click the hyperlink it will take the stateId from the click event and use the Get method to send it to the next page. Page 2 will simply use the browswer get method to show information based on that stateid. So my...
1
1178
by: Daniel | last post by:
Hi All, Does anyone know to send click event to the hyperlink?? What i mean is the user click on the button and the hyperlink click event will be trigger instead of persoanlly click on the hyperlink. Purpose of doing it, i need to filter some request from and direct to the suitable link. Any guideline? ideas?
19
3561
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred to here as page_2). I need to cache the value of the link's text (hyperlink.text property) so that I can use it in the page_load event of page_2. I've thought of using a hidden field and then calling Request.Form("hdnClickedLinkText") in the...
2
4733
by: Keith Wilby | last post by:
A2003, XP Pro. I have a text box on a form. The text box is bound to a hyperlink field. I want to use the contents of the text box in code so I'm assigning the contents to a string variable. Typically, the contents would be: T:\CSDI\Projects\Library\002\8021889.doc but when I look at the variable what I see is: T:\CSDI\Projects\Library\002\8021889.doc#T:\CSDI\Projects\Library\002\8021889.doc#
0
1844
by: lechatthierry | last post by:
Is it possible to block a mouse event on an Hyperlink with a general script event? This is quite troublesome for me. I am trying to find a way to block the windows shortcut SHIFT + MOUSE LEFT BUTTON that open the Hyperlink in a new window for a Web application. I just want to capture the Shift click event and prevent it from opening a new page. Mouse Wheel didn't pose any problems but the other mouse buttons seems to ignore the...
1
1956
by: Neko | last post by:
Is it possible to block a mouse event on an Hyperlink with a general script event? This is quite troublesome for me. I am trying to find a way to block the windows shortcut SHIFT + MOUSE LEFT BUTTON that open the Hyperlink in a new window for a Web application. I just want to capture the Shift click event and prevent it from opening a new page. Mouse Wheel didn't pose any problems but the other mouse buttons seems to ignore the...
6
2404
by: mramsay | last post by:
Hi, I am lost when it comes to creating a click event in asp. I have hyperlinks that are pulled dynamically from a table. An example is Hockey is a hyperlink. What I want to do is when a user selects the Hockey link, information regarding Hockey will be pulled from another table and displayed on a page. In order to do this, I have to create the click event for when the user selects the hyperlink Hockey it will pull the info from the...
0
9688
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7570
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.