[ENTER] key causing major headaches.

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

    [ENTER] key causing major headaches.

    Hi All,

    I'm very experienced in traditional ASP and am new to (am learning) ASP.NET.
    FYI: I am initially learning ASP.NET with VB.NET to ease the transition for
    me. I have encountered what I believe to be a huge limitation with ASP.NET
    and I'm wondering how you have handeled this problem.

    Let's suppose you have a page where the user can do one of two things: add a
    "Category", or add a "Movie Title" to an already existing category. This is
    just a make-believe scenario that I'm using to make a point: You have two
    distinct sections to your page... one section contains a text box and a
    button (for adding a new category) and another section contains a dropdown
    menu of categories, a text box, and a different button (for adding a new
    movie title).

    You can have have the Click event of the first button ("bAddCategory" )
    handle the addition of the new category, and you can have the Click event of
    the second button ("bAddMovie" ) add the new movie title. So far, so good.

    My problem is this: what if the user presses the [ENTER] key on his/her
    keyboard? Doing this does not fire either Click event. I can (in essence)
    make a "default" button by adding the following to the server-side Load
    event for the page:

    Page.RegisterHi ddenField("__EV ENTTARGET", bAddMovie.Clien tID)

    Doing this will cause the Click event for bAddMovie to fire when the user
    presses [ENTER]. However... I don't want bAddMovie to be the default button
    if the user is in the process of typing a new category name (in that case, I
    obviously would want bAddCategory to be the default).

    In traditional ASP, I would simply have two <form>s on the page. One <form>
    would encapsulate the widgets for entering a category and a second <form>
    would encapsulate the widgets for entering a movie. Each of the two <form>
    tags would contain a <input type="hidden"> element containing a name/value
    pair indicating which form was submitted on postback.

    In ASP.NET, I see no way to emulate this concept. ASP.NET does not let me
    have two form tags (with runat="server" defined). And, if I use a
    client-side (traditional) <form>, I cannot use any of the ASP.NET web
    controls (like <asp:DropDownLi st>, etc.). Not being able to use these web
    controls, to me, defeats the whole purpose of using ASP.NET. If I revert
    back to a traditional <form> tag, I don't get events, viewstates, or any
    other fancy ASP.NET features.

    This concept (of having two forms) is extremely important to me. What do I
    do!? Any and all help is very much appreciated!!


    Regards,

    Eric


  • Mythran

    #2
    Re: [ENTER] key causing major headaches.

    As you can do in Legacy ASP, try client-side script to control the OnKeyPress
    event of the form elements you want to capture the ENTER key for and simulate a
    button-click event for the element you want to click :)

    Mythran

    "Eric" <ejproduction s-msnews7831@mail blocks.com> wrote in message
    news:exRi9atWEH A.3716@TK2MSFTN GP11.phx.gbl...[color=blue]
    > Hi All,
    >
    > I'm very experienced in traditional ASP and am new to (am learning) ASP.NET.
    > FYI: I am initially learning ASP.NET with VB.NET to ease the transition for
    > me. I have encountered what I believe to be a huge limitation with ASP.NET
    > and I'm wondering how you have handeled this problem.
    >
    > Let's suppose you have a page where the user can do one of two things: add a
    > "Category", or add a "Movie Title" to an already existing category. This is
    > just a make-believe scenario that I'm using to make a point: You have two
    > distinct sections to your page... one section contains a text box and a
    > button (for adding a new category) and another section contains a dropdown
    > menu of categories, a text box, and a different button (for adding a new
    > movie title).
    >
    > You can have have the Click event of the first button ("bAddCategory" )
    > handle the addition of the new category, and you can have the Click event of
    > the second button ("bAddMovie" ) add the new movie title. So far, so good.
    >
    > My problem is this: what if the user presses the [ENTER] key on his/her
    > keyboard? Doing this does not fire either Click event. I can (in essence)
    > make a "default" button by adding the following to the server-side Load
    > event for the page:
    >
    > Page.RegisterHi ddenField("__EV ENTTARGET", bAddMovie.Clien tID)
    >
    > Doing this will cause the Click event for bAddMovie to fire when the user
    > presses [ENTER]. However... I don't want bAddMovie to be the default button
    > if the user is in the process of typing a new category name (in that case, I
    > obviously would want bAddCategory to be the default).
    >
    > In traditional ASP, I would simply have two <form>s on the page. One <form>
    > would encapsulate the widgets for entering a category and a second <form>
    > would encapsulate the widgets for entering a movie. Each of the two <form>
    > tags would contain a <input type="hidden"> element containing a name/value
    > pair indicating which form was submitted on postback.
    >
    > In ASP.NET, I see no way to emulate this concept. ASP.NET does not let me
    > have two form tags (with runat="server" defined). And, if I use a
    > client-side (traditional) <form>, I cannot use any of the ASP.NET web
    > controls (like <asp:DropDownLi st>, etc.). Not being able to use these web
    > controls, to me, defeats the whole purpose of using ASP.NET. If I revert
    > back to a traditional <form> tag, I don't get events, viewstates, or any
    > other fancy ASP.NET features.
    >
    > This concept (of having two forms) is extremely important to me. What do I
    > do!? Any and all help is very much appreciated!!
    >
    >
    > Regards,
    >
    > Eric
    >
    >[/color]


    Comment

    • Eric

      #3
      Re: [ENTER] key causing major headaches.

      Yeah... I figured I might have to do something like this, but honestly, I
      hate the idea that if the client has javascript disabled (or doesn't support
      it) then the page is not-only non-functional but actually functions
      incorrectly (forms are submitted with no server-side code to handle it).

      Thanks for the suggestion. I don't think there will be another way!

      Eric


      "Mythran" <kip_potter@hot mail.com> wrote in message
      news:%23S5xGstW EHA.2844@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      > As you can do in Legacy ASP, try client-side script to control the[/color]
      OnKeyPress[color=blue]
      > event of the form elements you want to capture the ENTER key for and[/color]
      simulate a[color=blue]
      > button-click event for the element you want to click :)
      >
      > Mythran
      >
      > "Eric" <ejproduction s-msnews7831@mail blocks.com> wrote in message
      > news:exRi9atWEH A.3716@TK2MSFTN GP11.phx.gbl...[color=green]
      > > Hi All,
      > >
      > > I'm very experienced in traditional ASP and am new to (am learning)[/color][/color]
      ASP.NET.[color=blue][color=green]
      > > FYI: I am initially learning ASP.NET with VB.NET to ease the transition[/color][/color]
      for[color=blue][color=green]
      > > me. I have encountered what I believe to be a huge limitation with[/color][/color]
      ASP.NET[color=blue][color=green]
      > > and I'm wondering how you have handeled this problem.
      > >
      > > Let's suppose you have a page where the user can do one of two things:[/color][/color]
      add a[color=blue][color=green]
      > > "Category", or add a "Movie Title" to an already existing category.[/color][/color]
      This is[color=blue][color=green]
      > > just a make-believe scenario that I'm using to make a point: You have[/color][/color]
      two[color=blue][color=green]
      > > distinct sections to your page... one section contains a text box and a
      > > button (for adding a new category) and another section contains a[/color][/color]
      dropdown[color=blue][color=green]
      > > menu of categories, a text box, and a different button (for adding a new
      > > movie title).
      > >
      > > You can have have the Click event of the first button ("bAddCategory" )
      > > handle the addition of the new category, and you can have the Click[/color][/color]
      event of[color=blue][color=green]
      > > the second button ("bAddMovie" ) add the new movie title. So far, so[/color][/color]
      good.[color=blue][color=green]
      > >
      > > My problem is this: what if the user presses the [ENTER] key on his/her
      > > keyboard? Doing this does not fire either Click event. I can (in[/color][/color]
      essence)[color=blue][color=green]
      > > make a "default" button by adding the following to the server-side Load
      > > event for the page:
      > >
      > > Page.RegisterHi ddenField("__EV ENTTARGET", bAddMovie.Clien tID)
      > >
      > > Doing this will cause the Click event for bAddMovie to fire when the[/color][/color]
      user[color=blue][color=green]
      > > presses [ENTER]. However... I don't want bAddMovie to be the default[/color][/color]
      button[color=blue][color=green]
      > > if the user is in the process of typing a new category name (in that[/color][/color]
      case, I[color=blue][color=green]
      > > obviously would want bAddCategory to be the default).
      > >
      > > In traditional ASP, I would simply have two <form>s on the page. One[/color][/color]
      <form>[color=blue][color=green]
      > > would encapsulate the widgets for entering a category and a second[/color][/color]
      <form>[color=blue][color=green]
      > > would encapsulate the widgets for entering a movie. Each of the two[/color][/color]
      <form>[color=blue][color=green]
      > > tags would contain a <input type="hidden"> element containing a[/color][/color]
      name/value[color=blue][color=green]
      > > pair indicating which form was submitted on postback.
      > >
      > > In ASP.NET, I see no way to emulate this concept. ASP.NET does not let[/color][/color]
      me[color=blue][color=green]
      > > have two form tags (with runat="server" defined). And, if I use a
      > > client-side (traditional) <form>, I cannot use any of the ASP.NET web
      > > controls (like <asp:DropDownLi st>, etc.). Not being able to use these[/color][/color]
      web[color=blue][color=green]
      > > controls, to me, defeats the whole purpose of using ASP.NET. If I[/color][/color]
      revert[color=blue][color=green]
      > > back to a traditional <form> tag, I don't get events, viewstates, or any
      > > other fancy ASP.NET features.
      > >
      > > This concept (of having two forms) is extremely important to me. What[/color][/color]
      do I[color=blue][color=green]
      > > do!? Any and all help is very much appreciated!!
      > >
      > >
      > > Regards,
      > >
      > > Eric
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Eric

        #4
        Re: [ENTER] key causing major headaches.

        Well Everyone,

        I believe I've stumbled upon an acceptable solution. For the
        curious-minded...

        An obvious solution would be to disable the [ENTER] button entirely. Doing
        this with javascript however, is a problem becaue if the client has
        javascript disabled or doesn't support it you will still get the same "ghost
        postbacks" where the source (clicked button) is unknown.

        My solution is to do this with an image instead of a button. To do this,
        create a <asp:LinkButton > object and set its Text property to be the HTML
        for an <img>. You can then use the Click event of the LinkButton object. I
        didn't think this would work for quite a while (because when I tested it, it
        didn't work). As it turns out, the reason my tests resulted in failure is
        because of bug in Internet Explorer...

        It turns out that if you have a <form> with less than two text boxes IE
        automatically submits the form when the [ENTER] key is pressed. This
        happens WHETHER OR NOT you have a submit button in the <form>. If you have
        2 OR MORE text boxes, IE will NOT automatically submit the form when [ENTER]
        is pressed. Instead, it will CLICK the first button it encounters following
        the widget with the focus. This latter behavior is what *should* occur
        regardless of the number of text boxes. So... to use my <asp:LinkButton >
        solution, you ALSO have to have at least 2 text boxes in the <form>. If
        your application only calls for one (or zero), you must supplement the
        "missing" text box(es) with hidden text box(es). This could be accomplished
        by using CSS to set the visibility to hidden, the width to 0, or both.

        Jumping through these hoops will give you the expected behavior. My next
        step will be to derive my own "ImageButto n" control (from asp:LinkButton)
        that includes the hidden text boxes. It may also accept an alternate
        MouseoverImage property to emulate the appearance of an actual button (using
        *optional* client-side javascript).

        If some jaded soul out there winds up as stuck as I was, I hope this
        solution finds them!


        Regards,

        Eric


        "Eric" <ejproduction s-msnews7831@mail blocks.com> wrote in message
        news:exRi9atWEH A.3716@TK2MSFTN GP11.phx.gbl...[color=blue]
        > Hi All,
        >
        > I'm very experienced in traditional ASP and am new to (am learning)[/color]
        ASP.NET.[color=blue]
        > FYI: I am initially learning ASP.NET with VB.NET to ease the transition[/color]
        for[color=blue]
        > me. I have encountered what I believe to be a huge limitation with[/color]
        ASP.NET[color=blue]
        > and I'm wondering how you have handeled this problem.
        >
        > Let's suppose you have a page where the user can do one of two things: add[/color]
        a[color=blue]
        > "Category", or add a "Movie Title" to an already existing category. This[/color]
        is[color=blue]
        > just a make-believe scenario that I'm using to make a point: You have two
        > distinct sections to your page... one section contains a text box and a
        > button (for adding a new category) and another section contains a dropdown
        > menu of categories, a text box, and a different button (for adding a new
        > movie title).
        >
        > You can have have the Click event of the first button ("bAddCategory" )
        > handle the addition of the new category, and you can have the Click event[/color]
        of[color=blue]
        > the second button ("bAddMovie" ) add the new movie title. So far, so good.
        >
        > My problem is this: what if the user presses the [ENTER] key on his/her
        > keyboard? Doing this does not fire either Click event. I can (in[/color]
        essence)[color=blue]
        > make a "default" button by adding the following to the server-side Load
        > event for the page:
        >
        > Page.RegisterHi ddenField("__EV ENTTARGET", bAddMovie.Clien tID)
        >
        > Doing this will cause the Click event for bAddMovie to fire when the user
        > presses [ENTER]. However... I don't want bAddMovie to be the default[/color]
        button[color=blue]
        > if the user is in the process of typing a new category name (in that case,[/color]
        I[color=blue]
        > obviously would want bAddCategory to be the default).
        >
        > In traditional ASP, I would simply have two <form>s on the page. One[/color]
        <form>[color=blue]
        > would encapsulate the widgets for entering a category and a second <form>
        > would encapsulate the widgets for entering a movie. Each of the two[/color]
        <form>[color=blue]
        > tags would contain a <input type="hidden"> element containing a name/value
        > pair indicating which form was submitted on postback.
        >
        > In ASP.NET, I see no way to emulate this concept. ASP.NET does not let me
        > have two form tags (with runat="server" defined). And, if I use a
        > client-side (traditional) <form>, I cannot use any of the ASP.NET web
        > controls (like <asp:DropDownLi st>, etc.). Not being able to use these web
        > controls, to me, defeats the whole purpose of using ASP.NET. If I revert
        > back to a traditional <form> tag, I don't get events, viewstates, or any
        > other fancy ASP.NET features.
        >
        > This concept (of having two forms) is extremely important to me. What do[/color]
        I[color=blue]
        > do!? Any and all help is very much appreciated!!
        >
        >
        > Regards,
        >
        > Eric
        >
        >[/color]


        Comment

        • Mythran

          #5
          Re: [ENTER] key causing major headaches.

          IN-LINE COMMENTS:

          "Eric" <ejproduction s-msnews7831@mail blocks.com> wrote in message
          news:%23vBybPuW EHA.3140@TK2MSF TNGP10.phx.gbl. ..[color=blue]
          > Well Everyone,
          >
          > I believe I've stumbled upon an acceptable solution. For the
          > curious-minded...
          >[/color]
          That's Me! 0>8-{P

          [color=blue]
          > An obvious solution would be to disable the [ENTER] button entirely. Doing
          > this with javascript however, is a problem becaue if the client has
          > javascript disabled or doesn't support it you will still get the same "ghost
          > postbacks" where the source (clicked button) is unknown.
          >[/color]
          The source (clicked button) is unknown for a very good reason. There is no
          button clicked :) It is the default for HTML forms. It does an automatic submit
          of the form w/o any buttons being clicked.
          [color=blue]
          > My solution is to do this with an image instead of a button. To do this,
          > create a <asp:LinkButton > object and set its Text property to be the HTML
          > for an <img>. You can then use the Click event of the LinkButton object. I
          > didn't think this would work for quite a while (because when I tested it, it
          > didn't work). As it turns out, the reason my tests resulted in failure is
          > because of bug in Internet Explorer...
          >[/color]

          <script language="JavaS cript">
          function Element_OnKeyPr ess(e)
          {
          if (!e) {
          e = window.event;

          if (!e) {
          alert('Could not get the event object!');
          }
          }

          var srcElement = e.srcElement;
          // Code to detect which button to simulate clicking.

          }
          </script>

          In the elements that are problematic, add the onkeypress event (Example:

          <input type="text" onkeypress="Jav aScript:Element _OnKeyPress(eve nt);">

          May want to double check e.srcElement. Can't remember if other browsers support
          it or not...

          [color=blue]
          > It turns out that if you have a <form> with less than two text boxes IE
          > automatically submits the form when the [ENTER] key is pressed. This
          > happens WHETHER OR NOT you have a submit button in the <form>. If you have
          > 2 OR MORE text boxes, IE will NOT automatically submit the form when [ENTER]
          > is pressed. Instead, it will CLICK the first button it encounters following
          > the widget with the focus. This latter behavior is what *should* occur
          > regardless of the number of text boxes. So... to use my <asp:LinkButton >
          > solution, you ALSO have to have at least 2 text boxes in the <form>. If
          > your application only calls for one (or zero), you must supplement the
          > "missing" text box(es) with hidden text box(es). This could be accomplished
          > by using CSS to set the visibility to hidden, the width to 0, or both.
          >[/color]
          Hrm, yer right...and I knew this but it didn't come to my mind earlier.
          [color=blue]
          > Jumping through these hoops will give you the expected behavior. My next
          > step will be to derive my own "ImageButto n" control (from asp:LinkButton)
          > that includes the hidden text boxes. It may also accept an alternate
          > MouseoverImage property to emulate the appearance of an actual button (using
          > *optional* client-side javascript).
          >[/color]
          [color=blue]
          > If some jaded soul out there winds up as stuck as I was, I hope this
          > solution finds them!
          >
          >
          > Regards,
          >
          > Eric
          >[/color]

          Regards,

          Mythran
          [color=blue]
          >
          > "Eric" <ejproduction s-msnews7831@mail blocks.com> wrote in message
          > news:exRi9atWEH A.3716@TK2MSFTN GP11.phx.gbl...[color=green]
          > > Hi All,
          > >
          > > I'm very experienced in traditional ASP and am new to (am learning)[/color]
          > ASP.NET.[color=green]
          > > FYI: I am initially learning ASP.NET with VB.NET to ease the transition[/color]
          > for[color=green]
          > > me. I have encountered what I believe to be a huge limitation with[/color]
          > ASP.NET[color=green]
          > > and I'm wondering how you have handeled this problem.
          > >
          > > Let's suppose you have a page where the user can do one of two things: add[/color]
          > a[color=green]
          > > "Category", or add a "Movie Title" to an already existing category. This[/color]
          > is[color=green]
          > > just a make-believe scenario that I'm using to make a point: You have two
          > > distinct sections to your page... one section contains a text box and a
          > > button (for adding a new category) and another section contains a dropdown
          > > menu of categories, a text box, and a different button (for adding a new
          > > movie title).
          > >
          > > You can have have the Click event of the first button ("bAddCategory" )
          > > handle the addition of the new category, and you can have the Click event[/color]
          > of[color=green]
          > > the second button ("bAddMovie" ) add the new movie title. So far, so good.
          > >
          > > My problem is this: what if the user presses the [ENTER] key on his/her
          > > keyboard? Doing this does not fire either Click event. I can (in[/color]
          > essence)[color=green]
          > > make a "default" button by adding the following to the server-side Load
          > > event for the page:
          > >
          > > Page.RegisterHi ddenField("__EV ENTTARGET", bAddMovie.Clien tID)
          > >
          > > Doing this will cause the Click event for bAddMovie to fire when the user
          > > presses [ENTER]. However... I don't want bAddMovie to be the default[/color]
          > button[color=green]
          > > if the user is in the process of typing a new category name (in that case,[/color]
          > I[color=green]
          > > obviously would want bAddCategory to be the default).
          > >
          > > In traditional ASP, I would simply have two <form>s on the page. One[/color]
          > <form>[color=green]
          > > would encapsulate the widgets for entering a category and a second <form>
          > > would encapsulate the widgets for entering a movie. Each of the two[/color]
          > <form>[color=green]
          > > tags would contain a <input type="hidden"> element containing a name/value
          > > pair indicating which form was submitted on postback.
          > >
          > > In ASP.NET, I see no way to emulate this concept. ASP.NET does not let me
          > > have two form tags (with runat="server" defined). And, if I use a
          > > client-side (traditional) <form>, I cannot use any of the ASP.NET web
          > > controls (like <asp:DropDownLi st>, etc.). Not being able to use these web
          > > controls, to me, defeats the whole purpose of using ASP.NET. If I revert
          > > back to a traditional <form> tag, I don't get events, viewstates, or any
          > > other fancy ASP.NET features.
          > >
          > > This concept (of having two forms) is extremely important to me. What do[/color]
          > I[color=green]
          > > do!? Any and all help is very much appreciated!!
          > >
          > >
          > > Regards,
          > >
          > > Eric
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Eric

            #6
            Re: [ENTER] key causing major headaches.

            Thanks! However, scenarios where javascript is disabled/not available on
            the client would result in unexpected (rather, annoying and
            hard-to-program-for) behavior (events would never get fired). I'd much
            rather the page require javascript or simply not function at all.
            Furthermore (a more minor thing), my demanding (lazy) nature requires that I
            don't have to do a lot of work (like putting a keypress event in every
            textbox). How about this:



            There's a DLL in there for your /bin directory, a sample ASPX file and a few
            images. The ZIP file is a hair over 6K. If you're scared of my DLL (I
            don't blame you), I included the ".vb" source file so that anyone can
            compile it themselves. I'm pleased with this solution and - woo hoo! - it's
            my first ever composite control! ;)

            Thanks again Mythran for your interest and assistance!!

            Eric


            "Mythran" <kip_potter@hot mail.com> wrote in message
            news:OWyZIOwWEH A.2940@TK2MSFTN GP09.phx.gbl...[color=blue]
            > IN-LINE COMMENTS:
            >
            > "Eric" <ejproduction s-msnews7831@mail blocks.com> wrote in message
            > news:%23vBybPuW EHA.3140@TK2MSF TNGP10.phx.gbl. ..[color=green]
            > > Well Everyone,
            > >
            > > I believe I've stumbled upon an acceptable solution. For the
            > > curious-minded...
            > >[/color]
            > That's Me! 0>8-{P
            >
            >[color=green]
            > > An obvious solution would be to disable the [ENTER] button entirely.[/color][/color]
            Doing[color=blue][color=green]
            > > this with javascript however, is a problem becaue if the client has
            > > javascript disabled or doesn't support it you will still get the same[/color][/color]
            "ghost[color=blue][color=green]
            > > postbacks" where the source (clicked button) is unknown.
            > >[/color]
            > The source (clicked button) is unknown for a very good reason. There is[/color]
            no[color=blue]
            > button clicked :) It is the default for HTML forms. It does an automatic[/color]
            submit[color=blue]
            > of the form w/o any buttons being clicked.
            >[color=green]
            > > My solution is to do this with an image instead of a button. To do[/color][/color]
            this,[color=blue][color=green]
            > > create a <asp:LinkButton > object and set its Text property to be the[/color][/color]
            HTML[color=blue][color=green]
            > > for an <img>. You can then use the Click event of the LinkButton[/color][/color]
            object. I[color=blue][color=green]
            > > didn't think this would work for quite a while (because when I tested[/color][/color]
            it, it[color=blue][color=green]
            > > didn't work). As it turns out, the reason my tests resulted in failure[/color][/color]
            is[color=blue][color=green]
            > > because of bug in Internet Explorer...
            > >[/color]
            >
            > <script language="JavaS cript">
            > function Element_OnKeyPr ess(e)
            > {
            > if (!e) {
            > e = window.event;
            >
            > if (!e) {
            > alert('Could not get the event object!');
            > }
            > }
            >
            > var srcElement = e.srcElement;
            > // Code to detect which button to simulate clicking.
            >
            > }
            > </script>
            >
            > In the elements that are problematic, add the onkeypress event (Example:
            >
            > <input type="text" onkeypress="Jav aScript:Element _OnKeyPress(eve nt);">
            >
            > May want to double check e.srcElement. Can't remember if other browsers[/color]
            support[color=blue]
            > it or not...
            >
            >[color=green]
            > > It turns out that if you have a <form> with less than two text boxes IE
            > > automatically submits the form when the [ENTER] key is pressed. This
            > > happens WHETHER OR NOT you have a submit button in the <form>. If you[/color][/color]
            have[color=blue][color=green]
            > > 2 OR MORE text boxes, IE will NOT automatically submit the form when[/color][/color]
            [ENTER][color=blue][color=green]
            > > is pressed. Instead, it will CLICK the first button it encounters[/color][/color]
            following[color=blue][color=green]
            > > the widget with the focus. This latter behavior is what *should* occur
            > > regardless of the number of text boxes. So... to use my[/color][/color]
            <asp:LinkButton >[color=blue][color=green]
            > > solution, you ALSO have to have at least 2 text boxes in the <form>. If
            > > your application only calls for one (or zero), you must supplement the
            > > "missing" text box(es) with hidden text box(es). This could be[/color][/color]
            accomplished[color=blue][color=green]
            > > by using CSS to set the visibility to hidden, the width to 0, or both.
            > >[/color]
            > Hrm, yer right...and I knew this but it didn't come to my mind earlier.
            >[color=green]
            > > Jumping through these hoops will give you the expected behavior. My[/color][/color]
            next[color=blue][color=green]
            > > step will be to derive my own "ImageButto n" control (from[/color][/color]
            asp:LinkButton)[color=blue][color=green]
            > > that includes the hidden text boxes. It may also accept an alternate
            > > MouseoverImage property to emulate the appearance of an actual button[/color][/color]
            (using[color=blue][color=green]
            > > *optional* client-side javascript).
            > >[/color]
            >[color=green]
            > > If some jaded soul out there winds up as stuck as I was, I hope this
            > > solution finds them!
            > >
            > >
            > > Regards,
            > >
            > > Eric
            > >[/color]
            >
            > Regards,
            >
            > Mythran
            >[color=green]
            > >
            > > "Eric" <ejproduction s-msnews7831@mail blocks.com> wrote in message
            > > news:exRi9atWEH A.3716@TK2MSFTN GP11.phx.gbl...[color=darkred]
            > > > Hi All,
            > > >
            > > > I'm very experienced in traditional ASP and am new to (am learning)[/color]
            > > ASP.NET.[color=darkred]
            > > > FYI: I am initially learning ASP.NET with VB.NET to ease the[/color][/color][/color]
            transition[color=blue][color=green]
            > > for[color=darkred]
            > > > me. I have encountered what I believe to be a huge limitation with[/color]
            > > ASP.NET[color=darkred]
            > > > and I'm wondering how you have handeled this problem.
            > > >
            > > > Let's suppose you have a page where the user can do one of two things:[/color][/color][/color]
            add[color=blue][color=green]
            > > a[color=darkred]
            > > > "Category", or add a "Movie Title" to an already existing category.[/color][/color][/color]
            This[color=blue][color=green]
            > > is[color=darkred]
            > > > just a make-believe scenario that I'm using to make a point: You have[/color][/color][/color]
            two[color=blue][color=green][color=darkred]
            > > > distinct sections to your page... one section contains a text box and[/color][/color][/color]
            a[color=blue][color=green][color=darkred]
            > > > button (for adding a new category) and another section contains a[/color][/color][/color]
            dropdown[color=blue][color=green][color=darkred]
            > > > menu of categories, a text box, and a different button (for adding a[/color][/color][/color]
            new[color=blue][color=green][color=darkred]
            > > > movie title).
            > > >
            > > > You can have have the Click event of the first button ("bAddCategory" )
            > > > handle the addition of the new category, and you can have the Click[/color][/color][/color]
            event[color=blue][color=green]
            > > of[color=darkred]
            > > > the second button ("bAddMovie" ) add the new movie title. So far, so[/color][/color][/color]
            good.[color=blue][color=green][color=darkred]
            > > >
            > > > My problem is this: what if the user presses the [ENTER] key on[/color][/color][/color]
            his/her[color=blue][color=green][color=darkred]
            > > > keyboard? Doing this does not fire either Click event. I can (in[/color]
            > > essence)[color=darkred]
            > > > make a "default" button by adding the following to the server-side[/color][/color][/color]
            Load[color=blue][color=green][color=darkred]
            > > > event for the page:
            > > >
            > > > Page.RegisterHi ddenField("__EV ENTTARGET", bAddMovie.Clien tID)
            > > >
            > > > Doing this will cause the Click event for bAddMovie to fire when the[/color][/color][/color]
            user[color=blue][color=green][color=darkred]
            > > > presses [ENTER]. However... I don't want bAddMovie to be the default[/color]
            > > button[color=darkred]
            > > > if the user is in the process of typing a new category name (in that[/color][/color][/color]
            case,[color=blue][color=green]
            > > I[color=darkred]
            > > > obviously would want bAddCategory to be the default).
            > > >
            > > > In traditional ASP, I would simply have two <form>s on the page. One[/color]
            > > <form>[color=darkred]
            > > > would encapsulate the widgets for entering a category and a second[/color][/color][/color]
            <form>[color=blue][color=green][color=darkred]
            > > > would encapsulate the widgets for entering a movie. Each of the two[/color]
            > > <form>[color=darkred]
            > > > tags would contain a <input type="hidden"> element containing a[/color][/color][/color]
            name/value[color=blue][color=green][color=darkred]
            > > > pair indicating which form was submitted on postback.
            > > >
            > > > In ASP.NET, I see no way to emulate this concept. ASP.NET does not[/color][/color][/color]
            let me[color=blue][color=green][color=darkred]
            > > > have two form tags (with runat="server" defined). And, if I use a
            > > > client-side (traditional) <form>, I cannot use any of the ASP.NET web
            > > > controls (like <asp:DropDownLi st>, etc.). Not being able to use these[/color][/color][/color]
            web[color=blue][color=green][color=darkred]
            > > > controls, to me, defeats the whole purpose of using ASP.NET. If I[/color][/color][/color]
            revert[color=blue][color=green][color=darkred]
            > > > back to a traditional <form> tag, I don't get events, viewstates, or[/color][/color][/color]
            any[color=blue][color=green][color=darkred]
            > > > other fancy ASP.NET features.
            > > >
            > > > This concept (of having two forms) is extremely important to me. What[/color][/color][/color]
            do[color=blue][color=green]
            > > I[color=darkred]
            > > > do!? Any and all help is very much appreciated!!
            > > >
            > > >
            > > > Regards,
            > > >
            > > > Eric
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...