473,320 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

CommandArgument & CommandName

RN1
Suppose I have a LinkButton whose Text is the name of a user (which is
being retrieved from a database). What I want is when I click this
LinkButton, I want the e-mail id of the user (which will be again
retrieved from the database). Now I can set the CommandArgument
property as well as the CommandName property of the LinkButton to the
e-mail id to achieve this.

So what difference does it make whether I use the CommandArgument or
the CommandName property of the LinkButton to do this? In other words,
what is the difference between CommandArgument & CommandName?

Thanks,

Ron
Sep 10 '08 #1
2 2801
Here this is just a special case as you have a single command at least for
now but what if you add a new commands at a later time or even worse another
command that also acts on mail ids ?

So IMO it's much better to keep CommandName to know *what* to do and
CommandArgument to know on *which* data to do this...
--
Patrice

"RN1" <rn**@rediffmail.coma écrit dans le message de groupe de discussion
: 03**********************************...oglegroups.com...
Suppose I have a LinkButton whose Text is the name of a user (which is
being retrieved from a database). What I want is when I click this
LinkButton, I want the e-mail id of the user (which will be again
retrieved from the database). Now I can set the CommandArgument
property as well as the CommandName property of the LinkButton to the
e-mail id to achieve this.

So what difference does it make whether I use the CommandArgument or
the CommandName property of the LinkButton to do this? In other words,
what is the difference between CommandArgument & CommandName?

Thanks,

Ron

Sep 10 '08 #2

I guess at the end of the day, they're just strings being passed in.

...

Of course, logically a "Argument" makes more sense for the person(id) or
person's email.

And if someone is ever going to look at your code, then don't do something
weird.
Stick with convention.
If you've ever said (while looking at someone elses code) "Who's the
brainiac who did this?"...then don't break the normal convention.

.......


"RN1" <rn**@rediffmail.comwrote in message
news:03**********************************@p10g2000 prf.googlegroups.com...
Suppose I have a LinkButton whose Text is the name of a user (which is
being retrieved from a database). What I want is when I click this
LinkButton, I want the e-mail id of the user (which will be again
retrieved from the database). Now I can set the CommandArgument
property as well as the CommandName property of the LinkButton to the
e-mail id to achieve this.

So what difference does it make whether I use the CommandArgument or
the CommandName property of the LinkButton to do this? In other words,
what is the difference between CommandArgument & CommandName?

Thanks,

Ron

Sep 10 '08 #3

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

Similar topics

0
by: Solomon Shaffer | last post by:
I have a datagrid that I am adding a template column to (containing a couple of linkbuttons) at runtime and am having some difficulty setting the commandargument or the linkbuttons. Does anyone...
1
by: Gilles T. | last post by:
Hi, I need to passing parameters in CommandArgument of the asp:ImageButton. I don't use datagrid or datalist Here is my code: Private Sub ImageButtonCommandHandler( sender As Object, e As...
1
by: Gilles T. | last post by:
Hi, I need to passing parameters in CommandArgument of the asp:ImageButton. I don't use datagrid or datalist Here is my code: Private Sub ImageButtonCommandHandler( sender As Object, e As...
1
by: Amil | last post by:
I use a LinkButton in a DataList. I want to set the CommandName and CommandArgument for the LinkButton. Then I want to, before the postback, examine them during Application_BeginRequest to...
2
by: jason | last post by:
i'm trying to set the commandargument property of a buttoncolumn in the DataGrid ItemBind event. it works fine in one instance, but in the latest page i've written it doesn't seem to work, and i...
2
by: David | last post by:
I have a template field in a GridView that contains two ImageButtons. When the user clicks one of the buttons, the GridView's RowCommand event is fired and I can get the CommandName. All that is...
3
by: Renilkumar | last post by:
I have a datagrid using link button. I am setting the CommandArgument value as .. <asp:linkbutton runat="server" EnableViewState=True CommandArgument='<%#...
1
nateraaaa
by: nateraaaa | last post by:
While working on a recent project I discovered how useful the CommandArgument property can be. I needed to determine the record_id of a row displayed in my datagrid. When the user clicked the Edit...
1
by: Leon Mayne | last post by:
Hello, I have a gridview that's bound to a generic list of business objects and am using the RowCommand event to capture user clicks on actions. This was working fine up until today, but now...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.