Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

How to reference EventArgs properties in event handler?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
clintonG - 30 Aug 2006 03:50 GMT
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.comman
dargument.aspx

[2]
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.commandeventa
rgs.commandargument.aspx

clintonG - 30 Aug 2006 03:56 GMT
Oops, this should have been put into
news://microsoft.public.dotnet.framework.aspnet and has been relocated...

<%= Clinton Gallagher

> When I use e. in an event handler all Intellisense wants to show me is:
>
[quoted text clipped - 41 lines]
> [2]
> http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.commandeventa
rgs.commandargument.aspx

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.