Published:
10 Nov 2003
|
Abstract
Track which buttons a user clicks using two properties of the LinkButton web control, CommandName and CommandArgument. This all takes place in the POST, so the querystring is shorter and the postback data is hidden.
|
 |
by Troy Karhoff
Feedback
|
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days):
25045/
36
|
|
|
Introduction |
This article covers a fundamental use of the .NET LinkButton web control for page postbacks.
A web developer is routinely faced with the challenge of knowing which link was clicked. The typical solution involves passing information on the querystring in the clear, like this: "GetProduct.asp?ID=3762". A key benefit of the LinkButton web control is the power to know which link was clicked by using POST rather than GET. This is accomplished by setting 2 properties on the LinkButton: CommandName and CommandArgument. These properties are passed into the onCommand event when the user clicks a LinkButton. In the event handler for onCommand, the CommandName and CommandArgument properties can be evaluated in CommandEventArgs. Because this all takes place in the POST, the querystring is shorter and the postback data is hidden. |
|
|
User Comments
Title:
please upload simple example
Name:
Abidha
Date:
2010-03-01 2:00:57 AM
Comment:
this seems difficult
|
Title:
Help for many developers!!
Name:
Vjeran
Date:
2006-03-29 12:46:51 PM
Comment:
Well.. i had problem, which is not only mine, and many developers don't know what to do but i found and answer!! Problem is in fact that, if u want to use postback u must generate controls after postback page load. If u don't render do this, evenhadler doesn't work... (?? it doesn't make sense viewstate in table control..).. Now everything works..
|
Title:
Link Button Despair
Name:
Bruce
Date:
2005-04-04 5:15:19 PM
Comment:
I was looking for a simple example showing a link within a page linking to another section of that page. This must be so obvious or so complex that no-one seems to be able to write a simple example. Looking at the source of other pages that perform this miracle is unhelpful. Could you try supplying a meaningful example that sheds some light on this very desirable tool, please?
|
Title:
Stale content
Name:
Diane
Date:
2004-12-30 11:14:03 AM
Comment:
I've been trying to find some information on using a link button for a week now. I'm finding that all the books and websites use the same limited set of examples. I will learn nothing more from your example here, than I did seeing it somewhere else. Why not go into aspects of the control that everyone else does NOT cover?
|
Title:
broken like
Name:
Tim
Date:
2004-10-05 12:33:35 PM
Comment:
this page is a broken url on the main menu
|
|
Product Spotlight
|
|