Default button inside a custom control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KJ

    #1

    Default button inside a custom control

    I have seen examples on how to set the default button on a ASPX page
    with asp server controls

    Sub Page_Load()

    Page.RegisterHi ddenField("__EV ENTTARGET", "btnSearch" )

    End Sub

    But that does not work if your default button is inside a custom
    control on a ASP.NET page. If someone think is does let me know what
    I'm doing wrong.

    Are they any way I can make that work?

    Thanks in advance
  • Steve C. Orr, MCSD

    #2
    Re: Default button inside a custom control

    Try modifying your code like this to make sure you're getting the full
    correct client side control id at run time:
    Page.RegisterHi ddenField("__EV ENTTARGET", btnSearch.Clien tID)

    --
    I hope this helps,
    Steve C. Orr, MCSD



    "KJ" <klj_mcsd@hotma il.com> wrote in message
    news:d83a9214.0 307171320.6b4af 103@posting.goo gle.com...[color=blue]
    > I have seen examples on how to set the default button on a ASPX page
    > with asp server controls
    >
    > Sub Page_Load()
    >
    > Page.RegisterHi ddenField("__EV ENTTARGET", "btnSearch" )
    >
    > End Sub
    >
    > But that does not work if your default button is inside a custom
    > control on a ASP.NET page. If someone think is does let me know what
    > I'm doing wrong.
    >
    > Are they any way I can make that work?
    >
    > Thanks in advance[/color]


    Comment

    • S. Justin Gengo

      #3
      Re: Default button inside a custom control

      KJ,

      I've use this script to set my default buttons from a text box. With a
      little modification it would work from other objects if you aren't using it
      from a text box.

      TextBox.Attribu tes.Add("onkeyd own", "javascript:if( (event.which &&
      event.which == 13) || (event.keyCode && event.keyCode ==
      13)){document.F orm1." & Button.ClientID & ".click();retur n false;}else
      return true;")

      --
      S. Justin Gengo, MCP
      Web Developer

      Free code library at:
      www.aboutfortunate.com

      "Out of chaos comes order."
      Nietzche
      "KJ" <klj_mcsd@hotma il.com> wrote in message
      news:d83a9214.0 307210518.19632 5b0@posting.goo gle.com...[color=blue]
      > That did not work. Any other suggestions?[/color]


      Comment

      • KJ

        #4
        Re: Default button inside a custom control

        Thanks

        Comment

        Working...