Professional Web Applications Themes

Default button inside a custom control - ASP.NET General

I have seen examples on how to set the default button on a ASPX page with asp server controls Sub Page_Load() Page.RegisterHiddenField("__EVENTTARGET", "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...

  1. #1

    Default 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.RegisterHiddenField("__EVENTTARGET", "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
    KJ Guest

  2. #2

    Default 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.RegisterHiddenField("__EVENTTARGET", btnSearch.ClientID)

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "KJ" <klj_mcsdhotmail.com> wrote in message
    news:d83a9214.0307171320.6b4af103posting.google.c om...
    > I have seen examples on how to set the default button on a ASPX page
    > with asp server controls
    >
    > Sub Page_Load()
    >
    > Page.RegisterHiddenField("__EVENTTARGET", "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 Guest

  3. #3

    Default 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.Attributes.Add("onkeydown", "javascript:if((event.which &&
    event.which == 13) || (event.keyCode && event.keyCode ==
    13)){doent.Form1." & Button.ClientID & ".click();return false;}else
    return true;")

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "KJ" <klj_mcsdhotmail.com> wrote in message
    news:d83a9214.0307210518.196325b0posting.google.c om...
    > That did not work. Any other suggestions?

    S. Justin Gengo Guest

  4. #4

    Default Re: Default button inside a custom control

    Thanks
    KJ Guest

Similar Threads

  1. Prevent certain tags inside custom control
    By MRe in forum ASP.NET Building Controls
    Replies: 0
    Last Post: August 24th, 02:07 PM
  2. Default toolbox tab for custom control?
    By Arthur Dent in forum ASP.NET Building Controls
    Replies: 1
    Last Post: April 15th, 10:44 AM
  3. Set the width of a custom control with 2 controls inside
    By Fernando Lopes in forum ASP.NET Building Controls
    Replies: 4
    Last Post: April 20th, 09:11 PM
  4. Fix the position of a custom control with 2 textboxes and 1 button.
    By Fernando Lopes in forum ASP.NET Building Controls
    Replies: 0
    Last Post: March 9th, 05:28 PM
  5. problem with image url browser button inside control colection designer?!??
    By Nenad Prekupec in forum ASP.NET Building Controls
    Replies: 0
    Last Post: November 20th, 08:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139