Setting the DefaultButton prop of a Panel under a Mountain of Templates

Discussion in 'ASP .Net' started by Steve Prescott, Jun 19, 2008.

  1. Hi Gang,

    I am trying to set the DefaultButton prop of a Panel so that when the user
    has entered his login credentials and strikes the < Enter > key, he will be
    loggin in. The Button (btnLogin) is buried under this hierarchy of parent
    controls: Panel > asp.LoginView > AnonymousTemplate > asp.Login >
    LayoutTemplate > btnLogin. I can't figure it out. Thanks for any ideas.

    Steve
    Steve Prescott, Jun 19, 2008
    #1
    1. Advertising

  2. Steve Prescott

    Munna Guest

    Re: Setting the DefaultButton prop of a Panel under a Mountain ofTemplates

    Hi,

    I am not sure wheither it will work or not... but still you can give a
    try...

    use find control to get the reference of the button from login control

    Button btn = (Button) Login1.FindControl("LoginButton");
    this.form1.DefaultButton = btn.ID;

    Best of luck

    Munna

    www.munna.shatkotha.com
    www.munna.shatkotha.com/blog
    www.shatkotha.com
    Munna, Jun 20, 2008
    #2
    1. Advertising

  3. Steve Prescott

    Uriah Piddle Guest

    Hu Munna,

    I wanted to thank you for your suggestion. I tried that before the post and
    it did not work. I wanted to return to the issue right after your post but
    got caught up in another thing. If I find that solution, I'll post it.
    Thanks.

    Steve

    "Munna" <> wrote in message
    news:...
    > Hi,
    >
    > I am not sure wheither it will work or not... but still you can give a
    > try...
    >
    > use find control to get the reference of the button from login control
    >
    > Button btn = (Button) Login1.FindControl("LoginButton");
    > this.form1.DefaultButton = btn.ID;
    >
    > Best of luck
    >
    > Munna
    >
    > www.munna.shatkotha.com
    > www.munna.shatkotha.com/blog
    > www.shatkotha.com
    Uriah Piddle, Jun 23, 2008
    #3
  4. I figured it out.

    Problem: Because you want users to login with the <Enter> instead of
    clicking a button, you want to make the login button of your login control
    the default button of the panel that contains it but panel cannot see the
    button because it is contained by a hierarchy of templates.

    Solution: nest a panel directly inside the Anonymous Template of your
    LoginView control. Make sure your Login control is contained inside this
    template. Set the DefaultButton prop of that panel to this: <Name of Login
    control><$><Name of Button>. So if your login control is named 'Login1' and
    the button is 'btnLogin' then set the DefaultButon prop to
    'Login1$btnLogin'.
    Steve Prescott, Jun 23, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    3,460
  2. Groove
    Replies:
    3
    Views:
    493
    Groove
    Jun 2, 2006
  3. Pierre
    Replies:
    13
    Views:
    618
    Ben Finney
    May 18, 2006
  4. John Mott
    Replies:
    3
    Views:
    1,527
    Olaf Rabbachin
    Dec 19, 2006
  5. Alex Maghen
    Replies:
    1
    Views:
    862
    Steven Cheng[MSFT]
    Feb 11, 2008
Loading...

Share This Page