How to reference EventArgs properties in event handler?

  • Thread starter Thread starter clintonG
  • Start date Start date
C

clintonG

When I use e. in an event handler all Intellisense wants to show me is:

// Event handler
protected void BuildNewFileButton_Click(Object sender, EventArgs e)
{
// can only 'see" these properties of e
e. [Equals | GetHashCode | GetType | ToString ]
// can only 'see" these properties of sender
sender.[Equals | GetHashCode | GetType | ToString ]
}

// BuildNewFileButton control declaration
<asp:Button ID="BuildNewFileButton"
OnCommand="BuildNewFileButton_Click"
CommandName="FileStructure"
CommandArgument="NoExtensions"
Text="Build New File"
runat="server"/>

The control declares a CommandName and CommandArgument and even though they
are properties documentation at MSDN shows they can be referenced (get) the
CommandArgument property through e as follows...

// Get value of CommandArgument
protected void BuildNewFileButton_Click(Object sender, EventArgs e)
{
if(e.CommandArgument == "NoExtensions")
// do something...
}

I've read the documents at MSDN [1,2] but I really still don't get how to
use an [OnCommand | OnClick] method with CommandName, and CommandArgument
properties...

....What am I failing to understand here?

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W

[1]
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.button.commandargument.aspx
[2]
http://msdn2.microsoft.com/en-us/li...ontrols.commandeventargs.commandargument.aspx
 
Oops, this should have been put into
news://microsoft.public.dotnet.framework.aspnet and has been relocated...

<%= Clinton Gallagher
 
Back
Top