473,785 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="selec ted"
value="0"></option>
<option value="1">Janua ry</option>
<option value="2">Febru ary</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">Augus t</option>
<option value="9">Septe mber</option>
<option value="10">Octo ber</option>
<option value="11">Nove mber</option>
<option value="12">Dece mber</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.A dd(new SqlParameter("@ month", SqlDbType.VarCh ar,
50));
co.Parameters["@month"].Value = bmonth.???????? ? ;
^
what should come inplase of ???????????
drop down list works fine with dropdownlistnam e.selecteditem. text;
but how this should be done with html select.
thanks in advance

Jul 4 '06 #1
6 1771
<na********@yah oo.comwrote in message
news:11******** **************@ j8g2000cwa.goog legroups.com...
what should come inplase of ???????????
bmonth.Selected Value; will return "1", "2" etc
bmonth.Selected Item.Text will return "January", "February" etc
Jul 4 '06 #2

Mark Rae wrote:
<na********@yah oo.comwrote in message
news:11******** **************@ j8g2000cwa.goog legroups.com...
what should come inplase of ???????????

bmonth.Selected Value; will return "1", "2" etc
bmonth.Selected Item.Text will return "January", "February" etc
Dear Rae,
im using vstudio express2005 and in that there is no option availible
like
bmonth.Selected Item.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(o bject sender, EventArgs e)
{
Label1.Text = "You selected: ";

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

regard
myself

Jul 4 '06 #4
<na********@yah oo.comwrote in message
news:11******** **************@ b68g2000cwa.goo glegroups.com.. .
Mark Rae wrote:
><na********@ya hoo.comwrote in message
news:11******* *************** @j8g2000cwa.goo glegroups.com.. .
what should come inplase of ???????????

bmonth.Selecte dValue; will return "1", "2" etc
bmonth.Selecte dItem.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.Selected Item.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
6600
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
8016
by: shlomi.schwartz | last post by:
Hi All, Is it possible to open the select (ComboBox) drop down list by script?
2
12623
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 select any skill in 1st drop down list then i'll select % of this skill in the 2nd list box , based on the percentage i've selected in the 2nd list box it has to display 2 sets of drop down list boxes at run time one for selecting skill and
1
2465
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 create the JavaScript function and wire it up to a link - but I need help with the syntax required to select one of the values in each Drop-Down list.
1
7955
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. The drop down list is called lstCountry I will have in an ASP variable the country code which was the value of the selected item when the form was posted...
2
10560
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 no predefined choice is applicable. It doesn't appear to me that a DropDownList control is editable. How would you suggest I accomplish what I want to do?
2
3235
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 value="3">Item 3</option> <option value="4">Item 4</option>
2
3339
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 has to open the drop down list again. I just wondered if there was a way using javascript to firstly detect if the user has selected the drop down list and if so, on refresh to set that drop down list to stay dropped down?
9
14494
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 loading it shows 'All' jobs, but when changed to 'Completed' it just shows Completed jobs. I'd like to use the onChange event to trigger this. What's the best way of achieving this in Cold Fusion? Thanks Neil
2
2485
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 drop down. can you please give me the code for this.
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.