Value from drop down

Discussion in 'ASP.NET / ASP.NET Core' started by BigZAJ, Dec 28, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have an HTML drop down menu with name='technician' which is composed of option values. When I try to write it to my db how do I request teh selected value in my ASP app. I was using Request.Form('technician') but it is giving me an error 'Item cannot be found in the collection corresponding to the requested name or ordinal.'

    Do I need like Request.Form'technician.value' or somethin?

    Thanks
     
  2. Try using this....


    <asp:dropdownlist runat="server" id="DropDownList1">
    <asp:listitem value="val1">value 1</asp:listitem>
    <asp:listitem value="val2">value 2</asp:listitem>
    <asp:listitem value="val3">value 3</asp:listitem>
    </asp:dropdownlist>
    <asp:Button id=Button1 runat="server" Text="Button" />



    private void Button1_Click(object sender, System.EventArgs e) {


    Response.Write(DropDownList1.SelectedValue);


    }


    Joel Thoms

    DiscountASP.NET
    http://www.DiscountASP.NET
     
  3. Honestly I'd love to, but the asp app only handles the post of an HTML form. My company just wants to reuse the HTML form they have now, I just changed the POST method because their web guy currently knows HTML and not ASP, Im just a temp. So in my HTML FORM its like this:

    <td width='145'>
    <select name='technician' width='146' style='width: 146px'>
    <option value=''></option>
    <option value='Carlos'>Carlos Gonzalez</option>
    <option value='John'>John Long</option>
    <option value='Giovanni'>Giovanni Moffet</option>
    <option value='Rob'>Rob Nordenstrom</option>
    </select>
    </td>

    This is the ASP: (relevant parts)

    Dim rsAdd

    ...stuff in between of course

    rsAdd.Fields('Technician') = Request.Form('technician') <===ERROR

    BTW, I just joined DiscountASP.net, great service and great tools
     
  4. Nevermind, fixed it.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page