How to use commandName in hyperlink control similar to Link button for some backend process.
I want Text of Hyperlink Which is clicked From a group of Hyperlinks to identify which hyperlink is clicked and based on it some backend code should be executed.How to retrieve the Text of Hyperlink when clicked.

Thanks,
A.Sushmaja

Recommended Answers

All 4 Replies

The problem is that the hyperlink control will redirect to some other page when you click on it. that's how hyperlinks work so you wouldnt be able to capture that information on the postback because there isnt a post back with a hyperlink control.

You need to use a linkbutton control instead.

Yes But i need it in Hyperlink as the styles are written accordingly.
The scenario is that In master page I have one main Menu.Based on the selection of Menu the submenu should be populated below it from database.SO i need the text which was selected.Please provide alternate solution for this problem.(The main Menu is written in Hyperlinks for having various atyles for it.)

LinkButton controls render as HTML <a> hyperlinks on the browser so that is the appropriate solution.

ASP.NET handles all of this via javascript and the post back via the form. Take a look at the source view using your browser.

The other alternative is to do something client side using javascript and AJAX. When a hyperlink is clicked, rather than allowing the normal event to trigger, send the hyperlinks ID back to the server, perform some process, send the results back to the browser, finish processing client side.

anthor solv:
not working hyperlink command name

:: hyperlink1.ToolTip='<%#Eval("ID")%>' ::

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.