@PSWorx said:
@jminkler said:@djork said:@Jeff S said:@djork said:Because the Login control has no method or property to access the login button and therefore no way to retrieve the unique ID. The only way to approximate the functionality is to view the HTML sent to the browser and put it in as a hard-coded string and hope that it doesn't change.But,
still, you can't get the actual UniqueID/ClientID of the login button
to set the DefaultButton for the form, so you're left implementing the
login by hand.Sorry. :)
Why can't you?
And it shouldn't, the login control following GOOD programming OOD doesn't know what the PAGE'S default button is .. and rightly so.
I don't think he meant the PAGE'S default button here but the log in button, that is actually PART of the login control.
Yeah dude, I realize that. His problem is that when someone types their name and password and hit "enter" the default button of the page is set to an ImageButton on the page rather than the Login Button. He wants the "enter" key to trigger the Login button rather than some random ImageButton somewhere on the page. Using the forms defaultpage property you can easily set the default control to be triggered when "enter" is pressed.
Here is the breakdown of the code I submitted
this.Form.DefaultButton = ((Button)Login1.FindControl("LoginButton")).UniqueID;
Login1 is the name of the login control. We use the FindControl method associated with the login control to find the login button named "LoginButton" which is child control of the LoginControl. We then cast the found control to a Button so that we can use the associated UniqueID property to get the ID of the control which is assigned to the pages default button.
Regardless as to whether I am confused on what he is trying to do he stated that it is impossible to get the control ID of a login button within a Login control. That couldn't be further from the truth, its very easy to do.