Tech Off Thread

8 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

DropDownListBox Or Combo Box

Back to Forum: Tech Off
  • User profile image
    RamblingGeek​UK

    I want an drop down list bo on a form which a user can either select th values presented to them or enter there own.

     

    So for an example a how many? drop down displays 1-10 but the user can enter 12.  I want the users reply databound but not the collection?

     

    Any suggests?

  • User profile image
    spivonious

    In a DropDownList the user cannot enter their own values.

  • User profile image
    RamblingGeek​UK

    spivonious said:

    In a DropDownList the user cannot enter their own values.

    That is corredt which is why I've looked at the AJAX Combo Box ontrol which works for data entry but not for editing... I was after a control suggestions or a suggested method of using one of the standard controls.

  • User profile image
    W3bbo

    Kryptos said:
    spivonious said:
    *snip*

    That is corredt which is why I've looked at the AJAX Combo Box ontrol which works for data entry but not for editing... I was after a control suggestions or a suggested method of using one of the standard controls.

    I take it with is WebForms as opposed to WinForms or WPF?

  • User profile image
    RamblingGeek​UK

    W3bbo said:
    Kryptos said:
    *snip*

    I take it with is WebForms as opposed to WinForms or WPF?

    It is indeed, webforms supports what I need, I what the same in webforms.

  • User profile image
    W3bbo

    Kryptos said:
    W3bbo said:
    *snip*

    It is indeed, webforms supports what I need, I what the same in webforms.

    You can't have a true WinForms-style ComboBox in WebForms simply because there isn't any HTML equivalent. As you've noticed the closest you can get are client-side scripts, which of course will fail if client scripting is disabled.

     

    In your situation I'd just put together a <select /> with all the predefined options but add an "Other, please specify" option. The <select /> would then have an <input type="text" /> underneath it with a <label> reading "Other:".

     

    It's usable and proven and can't go wrong. Don't forget to add <asp:RequiredFieldValidator /> to the Other field.

  • User profile image
    RamblingGeek​UK

    W3bbo said:
    Kryptos said:
    *snip*

    You can't have a true WinForms-style ComboBox in WebForms simply because there isn't any HTML equivalent. As you've noticed the closest you can get are client-side scripts, which of course will fail if client scripting is disabled.

     

    In your situation I'd just put together a <select /> with all the predefined options but add an "Other, please specify" option. The <select /> would then have an <input type="text" /> underneath it with a <label> reading "Other:".

     

    It's usable and proven and can't go wrong. Don't forget to add <asp:RequiredFieldValidator /> to the Other field.

    Thanks for the reply.... I thought that this may be the case...  Sad  Only wish I was told that this was requirement as I have 20 plus forms to go and change now.  Sad

     

    ANy suggestions for handling the back button?  So another record doesn't get insert....

  • User profile image
    W3bbo

    Kryptos said:
    W3bbo said:
    *snip*

    Thanks for the reply.... I thought that this may be the case...  Sad  Only wish I was told that this was requirement as I have 20 plus forms to go and change now.  Sad

     

    ANy suggestions for handling the back button?  So another record doesn't get insert....

    If you make your own control subclass that handles that specific case you can save yourself a load of time.

     

    What kind of problems are you having with the Back button? Are you getting the POSTDATA message in Firefox/IE? In that case after a postback to a server when an insert is made, do a Response.Redirect back to a 'safe' page.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.