By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,780 Members | 1,523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,780 IT Pros & Developers. It's quick & easy.

CommandArgument of a button

P: n/a
I have a button with a CommandArgument. The function that I call has
the following arguments, object sender, System.EventArgs e. Based on
those how can I get the value of the CommandArgument? I've tried the
following arguments, object sender, CommandEventArgs e, but they cause
compilation errors when I attempt to run my application.

Thanks in advance.

May 17 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Button1_Click(object sender, EventArgs e)
{
Button btn = sender as Button;
string cmdArg = btn.CommandArgument;
}

May 17 '06 #2

P: n/a
HI,

I guest you are talking about ASP.net if so you can't use onClick but
onCommand

<asp:Button Runat=server OnCommand="ProcessCommand"
CommandArgument="XXX"></asp:Button>
cheers,

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"IndyChris" <ch***********@yahoo.com> wrote in message
news:11**********************@j55g2000cwa.googlegr oups.com...
I have a button with a CommandArgument. The function that I call has
the following arguments, object sender, System.EventArgs e. Based on
those how can I get the value of the CommandArgument? I've tried the
following arguments, object sender, CommandEventArgs e, but they cause
compilation errors when I attempt to run my application.

Thanks in advance.

May 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.