473,396 Members | 1,898 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,396 software developers and data experts.

Control Events renamed in ASPX - What a shame

Hello!

Today it came to me that ASP.NET has a special "feature" that takes an
event name defined on a control and adds the "On" prefix for it when it
is used in the ASPX file ie.: when you use the Button control, to wire
up the Click event you have to use the OnClick event.
Now that is a shame! Why ASP.NET changes the names of my events and
only in ASPX file (in the code behind the same event is named
correctly)?
I can see only problems that result from this one of the most obvious
is that it is not possible to define a client side "onclick" event for
the button, because ASP.NET already uses this name for my Click (!!!)
event.

Is there at least one GOOD reason why ASP.NET does what it does in a
way it is doing it?

--
Michal

Mar 15 '06 #1
3 1094
the orignal design of asp.net was to avoid client code, and to match winform
syntax thru abstract controls. now that ajax has made client code popular
again, this is somewhat an issue. the next release will have ajax aware
controls that makes linking client script less messy.

-- bruce (sqlwork.com)
"Mikeon" <mi****@icpnet.pl> wrote in message
news:11*********************@j33g2000cwa.googlegro ups.com...
Hello!

Today it came to me that ASP.NET has a special "feature" that takes an
event name defined on a control and adds the "On" prefix for it when it
is used in the ASPX file ie.: when you use the Button control, to wire
up the Click event you have to use the OnClick event.
Now that is a shame! Why ASP.NET changes the names of my events and
only in ASPX file (in the code behind the same event is named
correctly)?
I can see only problems that result from this one of the most obvious
is that it is not possible to define a client side "onclick" event for
the button, because ASP.NET already uses this name for my Click (!!!)
event.

Is there at least one GOOD reason why ASP.NET does what it does in a
way it is doing it?

--
Michal

Mar 15 '06 #2
Hello!

I don't know how renaming events can be influenced by the design that
mimics the winforms other than making it inconsistent with the rest of
the code.

--
Michal

Mar 15 '06 #3
Michal, the model in asp.net 2.0 is to provide handlers for BOTH client
side and server side. Buttons now have OnClick for server events and
OnClientClick for client-side. In my opinion, this is actually a very
good thing!

Quick example here:

http://www.c-sharpcorner.com/Code/20...edControls.asp

JP

Mar 16 '06 #4

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

Similar topics

2
by: Simon Kravis | last post by:
After adding a TabControl to an Access 2000 form during screen redesign, I found that when cutting and pasting a group of controls (option groups, option buttons, command buttons, MSFlexGrid) into...
0
by: ab_j | last post by:
I have a user control that contains a dropdown which I want to use as a menu on multiple .aspx pages. Basically, all I am trying to do is pass the selected value of the dropdown in the user...
4
by: louise raisbeck | last post by:
Resending this as own topic as didnt get answer from original. Would be grateful for a response from anyone that knows. Thanks. Hi there, I found your post really helpful..but i wondered if, once...
4
by: Steve Murphy | last post by:
I'd like to package a navigation bar into a user control. The problem I'm having is getting the rollover buttons to work. Where do I place the Javascript for the image caching and switching for the...
1
by: tony | last post by:
Hello! I just want to find out how the system find the name to set on a assembly User control dll. I have done this. 1. Create a user control - Here the namespace was set by the system to...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
7
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm new to Visual Studio 2005. I'm creating a windows application using Visual Basic. After I added a control to a form and added some codings to the control, I want to rename the control. ...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.