473,406 Members | 2,867 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,406 software developers and data experts.

How to reference EventArgs properties in event handler?

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/lib...dargument.aspx
[2]
http://msdn2.microsoft.com/en-us/lib...dargument.aspx
Aug 30 '06 #1
1 4334
Oops, this should have been put into
news://microsoft.public.dotnet.framework.aspnet and has been relocated...

<%= Clinton Gallagher
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.comwro te in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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/lib...dargument.aspx
[2]
http://msdn2.microsoft.com/en-us/lib...dargument.aspx

Aug 30 '06 #2

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

Similar topics

1
by: Diotima | last post by:
I'm raising an event from a C# component and trying to catch it in a VB.NET Windows application. The VB app recognizes my custom EventArgs object and catches the event. However, when I try to read...
4
by: Steve Amey | last post by:
Hi all I am creating a basic control to perform some tasks, and I want to declare some events to be raised so they can be handled from the form that the control is on. I can create my own Event...
3
by: Poewood | last post by:
Okay here are four classes for a pocket pc program: Input, fpositional, ComboBoxArray and TextBoxArray. The "input" class is the form. I use the fpositional class to handle most of the functions...
5
by: memememe | last post by:
is there a way to pass values using the eventargs of a certain event, lets say onclick?? or how does everyone else pass values? lets say each button has 5 things (string, ints, etc) it needs to...
3
by: Yangtsi River | last post by:
Hi, in any event procudure,there is two paras:sender As Object, e As EventArgs, i copied them-not know what they are about, and my ASPX works. I guess the sender is the control by which I...
2
by: Giovanni Bassi | last post by:
Hello All, I have encountered a problem. I am using visual inheritance and my base form adds an event handler on Form Load using the AddHandler Keyword. The problem is that if the Event...
3
by: Kris Palmer | last post by:
hi, can somebody explain this problem? it's driving me crazy! i have a requirement to dynamically create a variable quantity of timers with associated start button based on the contents of a...
6
by: clintonG | last post by:
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...
3
by: Tony | last post by:
Hello! One more thing assume I create an event and an object derived from the eventArgs containing some info about the event. Then create another event also with an object derived from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.