Click here to Skip to main content
15,898,374 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can you pls help me ans the following question?
Also pls explain why it is so.

When an asp.net server control is added to a web form, visual studio.net adds one item to the class for the form. What item is added?
a. The eventt registration
b. A protected class member for the control
c. a default event handler for the click event
d. a default class that inherits from control's base class
Posted
Updated 13-Aug-10 0:13am
v2
Comments
R. Giskard Reventlov 13-Aug-10 6:30am    
Is this homework? We don't do homework.
RedHearts 13-Aug-10 6:47am    
Nope. It's not homework. We had a quiz. and we answered option (b)
They said it was wrong and said answer was option (c). Just wanted to cross verify.

Well, instead of getting an answer to it, why not go ahead and try it out. It would hardly take 10min.

It's a very direct thing and would not have a descriptive answer that can be argued upon.

BTW, you can always ask 'them' what does 'default event hanlder' mean here. If it would be something like, drag a button and do nothing more, now run the application and click the button, would the page get postback?
 
Share this answer
 
Comments
RedHearts 16-Aug-10 1:29am    
Yes the page gets postback.. I guess the question is not clear, I need to get it cleared.. Thanks :)
When I create a textbox and give it an ID, "myTextbox", the following gets added to the designer.vb file (assuming you are using VB.Net):
VB
'''<summary>
'''myTextbox control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents myTextbox As Global.System.Web.UI.WebControls.TextBox

But that only happens after I give the textbox an ID. I'd say the correct answer is "none of the above". If, however, they must have an answer I'd say the correct one would have to be "b". No event handlers are added unless you double click the textbox, and even then the event handler is for the "text changed" event. So, the event depends on the control created and would not be the click event in all cases. Bring this to your teacher... maybe they will listen.
 
Share this answer
 
Comments
RedHearts 16-Aug-10 1:28am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900