473,320 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

html select like drop down list

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 '06 #1
6 1744
<na********@yahoo.comwrote in message
news:11**********************@j8g2000cwa.googlegro ups.com...
what should come inplase of ???????????
bmonth.SelectedValue; will return "1", "2" etc
bmonth.SelectedItem.Text will return "January", "February" etc
Jul 4 '06 #2

Mark Rae wrote:
<na********@yahoo.comwrote in message
news:11**********************@j8g2000cwa.googlegro ups.com...
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 '06 #3

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[i].Selected)
Label1.Text += " -" + bmonth.Items[i].Text;
}
}

regard
myself

Jul 4 '06 #4
<na********@yahoo.comwrote in message
news:11**********************@b68g2000cwa.googlegr oups.com...
Mark Rae wrote:
><na********@yahoo.comwrote in message
news:11**********************@j8g2000cwa.googlegr oups.com...
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...?

Jul 4 '06 #5
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 '06 #6
Alternatively, you can use a HtmlSelect control. it's like the standard
HTML Select control but with a runat="server" attribute.

To get the selected value, simply use

mySelect.Value

http://authors.aspalliance.com/aspxt...mlSelect2.aspx

Jul 4 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: deko | last post by:
I populate a drop-down list like this: echo "<select>"; foreach ( $ip_list as $var ) { echo "<option>"; echo $var; echo "</option>"; } echo "</select>";
4
by: shlomi.schwartz | last post by:
Hi All, Is it possible to open the select (ComboBox) drop down list by script?
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
1
by: PB | last post by:
I have an aspx with 4 Drop-Down list boxes on it. All the list values are hard-coded in the aspx. I want a client-side JavaScript function to select a value in each of those DDLs. I can...
1
by: Rob Meade | last post by:
Hi all, I post back to my page if the form hasn't been submitted with the required information. I would like to with a little javascript, auto-select an option in the drop down list on my page....
2
by: Henry | last post by:
Hi all, I would like to use a control on a WebForm that acts like an editable DropDownList control. The user should be able to select a value from the list of choices, or type in a new value if...
2
by: magix | last post by:
I have an drop down list let say: <SELECT name="id" id="id" OnClick="Skip()"> <option value="0"></option> <option value="1">Item 1</option> <option value="2">Item 2</option> <option...
2
by: crazychrisy54 | last post by:
Hi there I have a option, select drop down list which a user can open. My page however refreshes very frequently and when this occurs the selected drop down list will pop back up. The user then...
9
by: ndeeley | last post by:
Hi, I have a CF query that extracts all the information from a db and sprays in into a table. I'd like a drop down list box that can filter this data based on the value in the box. IE at...
2
by: matamala Naresh | last post by:
in the table 3 fields are available (id,name,dept) iam creating drop down list with names.when user selects name in the drop down we need to auto pop up the department(dept) of that selected name in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.