Default Button: RegisterHiddenField

Discussion in 'ASP .Net' started by John Smith, Aug 16, 2005.

  1. John Smith

    John Smith Guest

    I am having a brain fart today....

    How do you set a default button within a User Control? I am using
    "Page.RegisterHiddenField("__EVENTTARGET", "btnSubmit")" but it does not
    seem to be working for me.

    I have another User Control which uses this technique and works. Can't
    think of what I am missing?

    --
    Thanx in Advance,

    atr2000
     
    John Smith, Aug 16, 2005
    #1
    1. Advertising

  2. Check the name of the Button through the Html Source (in IE)
    When you register a control on your page, it renames your controls with
    [ControlTagName]_[IDYOUSET]
    you can pick this up by viewing source from IE, and viewing the now changed
    ID of your button 'btnsubmit'

    to fix this, just change your javascript with the new id
    "Page.RegisterHiddenField("__EVENTTARGET", "[TAGNAME]_btnSubmit")"
    Bearing in mind for this solution, you'll need to give the control the same
    tagname wherever you use it - unless the javascript is in the page and not
    the control

    HTH


    "John Smith" <> wrote in message
    news:...
    >I am having a brain fart today....
    >
    > How do you set a default button within a User Control? I am using
    > "Page.RegisterHiddenField("__EVENTTARGET", "btnSubmit")" but it does not
    > seem to be working for me.
    >
    > I have another User Control which uses this technique and works. Can't
    > think of what I am missing?
    >
    > --
    > Thanx in Advance,
    >
    > atr2000
    >
    >
     
    Grant Merwitz, Aug 16, 2005
    #2
    1. Advertising

  3. John Smith

    Andrea Zani Guest

    John Smith <> ha scritto:
    > I am having a brain fart today....
    >
    > How do you set a default button within a User Control? I am using
    > "Page.RegisterHiddenField("__EVENTTARGET", "btnSubmit")" but it does
    > not seem to be working for me.
    >
    > I have another User Control which uses this technique and works.
    > Can't think of what I am missing?


    Page.RegisterHiddenField("__EVENTTARGET", btnSubmit.UniqueID)

    --
    AZ [Microsoft - .NET MVP]
    Mia Home page: http://ciclismo.sitiasp.it
    Asp.Net community: http://www.aspitalia.com
    Il mio blog: http://blogs.aspitalia.com/az
     
    Andrea Zani, Aug 16, 2005
    #3
  4. John Smith

    John Smith Guest

    That worked thanx a lot

    --
    Thanx in Advance,

    atr2000
    "Andrea Zani" <> wrote in message
    news:GMnMe.19198$...
    > John Smith <> ha scritto:
    > > I am having a brain fart today....
    > >
    > > How do you set a default button within a User Control? I am using
    > > "Page.RegisterHiddenField("__EVENTTARGET", "btnSubmit")" but it does
    > > not seem to be working for me.
    > >
    > > I have another User Control which uses this technique and works.
    > > Can't think of what I am missing?

    >
    > Page.RegisterHiddenField("__EVENTTARGET", btnSubmit.UniqueID)
    >
    > --
    > AZ [Microsoft - .NET MVP]
    > Mia Home page: http://ciclismo.sitiasp.it
    > Asp.Net community: http://www.aspitalia.com
    > Il mio blog: http://blogs.aspitalia.com/az
    >
    >
     
    John Smith, Aug 16, 2005
    #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. Matthew Wieder
    Replies:
    1
    Views:
    390
    Yan-Hong Huang[MSFT]
    Jul 22, 2003
  2. MeDhanush
    Replies:
    1
    Views:
    937
    Natty Gur
    Aug 28, 2003
  3. Kevin Spencer

    RegisterHiddenField and trace

    Kevin Spencer, Oct 21, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,098
    Erik Cruz
    Oct 22, 2003
  4. Francis
    Replies:
    0
    Views:
    688
    Francis
    Nov 3, 2003
  5. Cliff Harris

    Re-RegisterHiddenField

    Cliff Harris, Nov 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    409
    Cliff Harris
    Nov 5, 2003
Loading...

Share This Page