DropDownList and AutoPostback -- default item

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default DropDownList and AutoPostback -- default item

    Hello --

    Is there a way to prevent the autopostback of a drop down list if there is a
    "default" item in the list -- example, a drop down list where the first item
    says "Select One" and the remaining items are all values available for
    selection....if the user changes the selection I want to postback, unless
    they are selecting the default item. Is there a way to do this using
    autopostback? Or should I just use client side script and force a
    form-submit when the value is changed?

    Any tips or suggestions?

    Thanks in advance!


    Null Guest

  2. Similar Questions and Discussions

    1. Asp.net DropDownList, AutoPostBack, and ViewState
      I'm trying to finish off do an ASP.NET project where a DropDownList box is used to access a Table. Once you Make a selection on an item in the...
    2. can't set the selected item of the dropdownlist
      I generate template columns in datagrid dynamic and I want dropdownlist in the EditItemTemplate, I did it But I can't set the selected item of...
    3. AutoPostback DropDownList in EditItemTemplate
      I have a dropdownlist as an item in my edititemtemplate. I need to populate a texbox in the same edititemtemplate with the contents of the...
    4. dropdownlist autopostback when editing in datagrid
      I have multiple dropdownlists in edit mode of my datagrid. list 1 effects the members of list 2 i.e. list 1 --> department list 2 --> department...
    5. capture dropdownlist in edit mode autopostback
      I have a datagrid that in edit mode shows a dropdownlist. I need to be able to postback and manipulate some of the edit template controls depending...
  3. #2

    Default Re: DropDownList and AutoPostback -- default item

    Null,

    You could use a required field validator. Set its "ControlToValidate"
    property to true and set its "InitialValue" to "Select One" (no quotes).
    This would keep the drop down from posting back unless the selection is
    something other than "Select One".

    The only problem with the above method is that if there are form fields for
    submission the form won't submit unless a user selects a value from your
    drop down first. If you need them to select one no matter what then this is
    the best solution.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

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

    "Out of chaos comes order."
    Nietzche
    "Null" <farthumstill@hotmail.com> wrote in message
    news:eOJE2E2WDHA.1480@tk2msftngp13.phx.gbl...
    > Hello --
    >
    > Is there a way to prevent the autopostback of a drop down list if there is
    a
    > "default" item in the list -- example, a drop down list where the first
    item
    > says "Select One" and the remaining items are all values available for
    > selection....if the user changes the selection I want to postback, unless
    > they are selecting the default item. Is there a way to do this using
    > autopostback? Or should I just use client side script and force a
    > form-submit when the value is changed?
    >
    > Any tips or suggestions?
    >
    > Thanks in advance!
    >
    >

    S. Justin Gengo Guest

Posting Permissions

  • You may not post new threads
  • You may 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