Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
 
i would like to know the coding inside the login button that the ASP.Net generates automatically when i start the new Website. the button is in the Login.aspx form and insite the asp:Login tag.
it says like this :
 
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="LoginUserValidationGroup"/>
I curious with :
 
1. CommandName = "Login" what is that ?
2. Where ASP.Net put the code to execute it ? since i want to see how ASP.Net do login for me.
 
thanx a lot.
Posted 8-Dec-10 18:41pm
Edited 8-Dec-10 18:52pm
m@dhu29.5K
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
this is used in the buttons event handler that can be set via attribute OnCommand. Then in the event handler you can access the parameter of type CommandEventArgs and inspect the value e.CommandName where e is the name of the CommandEventArgs parameter.
It can be used to have one handler method that does the work for more than one button or different jobs depending on your program flow.
 
Please read the example the following link points to, it's pretty clear:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.commandname.aspx
 

Cheers,
 

Manfred
  Permalink  
v2
Comments
ManfredRBihy at 15-Dec-10 3:10am
   
If you have acces to the code behind files for your application search it for LoginButton and look out for places where event handlers are getting hooked up especially OnClick and OnCommand. If you don't have access to the code behind files ... lots o' luck pal :)
edyzakaria at 14-Dec-10 22:24pm
   
I've read that, thank you.
But still not for me. When i explore about the commandname in msdn i also arrived at there. but not the thing that i want.
in the example showing that e.commandname submit doing something. that is the thing that i want to know from commandname Login.
but i also have considering that my question might be quite sensitive since looks like the logic behind that commandname "login" is not open.
 
So if anybody out there know that it is a "closed logic/code" please inform me. :)
_ZaiT_ at 3-Jan-14 10:59am
   
Hi

After I start browsing my asp.net code
<asp:button runat="server" commandname="Login" text="Log in" xmlns:asp="#unknown" />
in html it appear like this
<input type="submit" name="ctl00$MainContent$ctl00$ctl06" value="Log in" önclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$MainContent$ctl00$ctl06", "", true, "", "", false, false))" />
I can't understand how it works. Can anybody explain this?
Thank you.
CHill60 at 3-Jan-14 15:11pm
   
By posting your question as a comment to a solution, only Manfred will be notified about it. To get the maximum number of people viewing your question you can use the Ask a Question link.

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

  Print Answers RSS
0 OriginalGriff 341
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 220
3 Praneet Nadkar 197
4 Shweta N Mishra 161
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 3 Jan 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100