html select like drop down list

Discussion in 'ASP .Net' started by nasirmajor@yahoo.com, Jul 4, 2006.

  1. Guest

    Dear all,
    a simple quetion as usual
    I have a html select list. e.g
    <select class="text" name="bmonth" runat="server" id="bmonth">
    <option selected="selected"
    value="0"></option>
    <option value="1">January</option>
    <option value="2">February</option>
    <option value="3">March</option>
    <option value="4">April</option>
    <option value="5">May</option>
    <option value="6">June</option>
    <option value="7">July</option>
    <option value="8">August</option>
    <option value="9">September</option>
    <option value="10">October</option>
    <option value="11">November</option>
    <option value="12">December</option>
    </select>

    and sql database in which i want to save the text of the selected month
    from this html select control. like

    co.Parameters.Add(new SqlParameter("@month", SqlDbType.VarChar,
    50));
    co.Parameters["@month"].Value = bmonth.????????? ;
    ^
    what should come inplase of ???????????
    drop down list works fine with dropdownlistname.selecteditem.text;
    but how this should be done with html select.
    thanks in advance
     
    , Jul 4, 2006
    #1
    1. Advertising

  2. Mark Rae Guest

    <> wrote in message
    news:...

    > what should come inplase of ???????????


    bmonth.SelectedValue; will return "1", "2" etc
    bmonth.SelectedItem.Text will return "January", "February" etc
     
    Mark Rae, Jul 4, 2006
    #2
    1. Advertising

  3. Guest

    Mark Rae wrote:
    > <> wrote in message
    > news:...
    >
    > > what should come inplase of ???????????

    >
    > bmonth.SelectedValue; will return "1", "2" etc
    > bmonth.SelectedItem.Text will return "January", "February" etc


    Dear Rae,
    im using vstudio express2005 and in that there is no option availible
    like
    bmonth.SelectedItem.Text for html select. this is availible only for
    server
    control i.e dropdown list
     
    , Jul 4, 2006
    #3
  4. Guest

    Dear myself
    i think its not possible without this

    protected void Button1_Click(object sender, EventArgs e)
    {
    Label1.Text = "You selected: ";

    for (int i = 0; i <= bmonth.Items.Count-1; i++)
    {
    if (bmonth.Items.Selected)
    Label1.Text += " -" + bmonth.Items.Text;
    }


    }

    regard
    myself
     
    , Jul 4, 2006
    #4
  5. Mark Rae Guest

    <> wrote in message
    news:...

    > Mark Rae wrote:
    >> <> wrote in message
    >> news:...
    >>
    >> > what should come inplase of ???????????

    >>
    >> bmonth.SelectedValue; will return "1", "2" etc
    >> bmonth.SelectedItem.Text will return "January", "February" etc

    >
    > Dear Rae,


    No need to be so formal - Mark will do...:)

    > im using vstudio express2005 and in that there is no option availible
    > like
    > bmonth.SelectedItem.Text for html select. this is availible only for
    > server
    > control i.e dropdown list


    Oh right - now I see what you mean. Obviously, an easy way to get round your
    problem would be to use a server-side DropDownList - is there any particular
    reason you can't do that...?
     
    Mark Rae, Jul 4, 2006
    #5
  6. Guest

    ThankYou Dear Mark,
    yes dear there is a big reasion:
    the resion is: i have a big list box of more than 200 countries already
    filled and i did'nt want
    to fill the drop down list with that 200 countries.
    thats why i asked the quetion
    however new code is working.
    if you have any smaller version
    it will be my pleasure to use that.
    thanks.
    regards
    nasir.
     
    , Jul 4, 2006
    #6
  7. ReyN Guest

    ReyN, Jul 4, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SirPoonga
    Replies:
    2
    Views:
    781
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,033
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    497
    msimmons
    Jul 16, 2009
  4. Replies:
    5
    Views:
    282
  5. Replies:
    3
    Views:
    296
Loading...

Share This Page