html-select

Html.DropDownList selected value not working using ViewBag

别说谁变了你拦得住时间么 提交于 2019-11-30 23:14:54
Well, after a couple hours reading stuff over here, trying unsuccessfully all the solutions, also found this article that i thought it would save my life... nothing. Long story short. Here is my View (all combinations) @Html.DropDownList("yearDropDown",(IEnumerable<SelectListItem>)ViewBag.yearDropDown) @Html.DropDownList("yearDropDownxxx",(IEnumerable<SelectListItem>)ViewBag.yearDropDown) @Html.DropDownList("yearDropDown",(<SelectList>)ViewBag.yearDropDown) @Html.DropDownList("yearDropDown") Here is my Controller public ActionResult(int year) { var years = new int[] { 2007, 2008, 2009, 2010,

value of select elements with “e.value” vs “e.options[e.selectedIndex].value”

こ雲淡風輕ζ 提交于 2019-11-30 22:52:41
Given the HTML: <select id="mySelect"> <option value="1">test1</option> <option value="2">test2</option> <option value="3">test3</option> </select> and the javascript: var e = document.getElementById('mySelect'); To get the value of the select I can use e.value and e.options[e.selectedIndex].value . I am aware that e.options[e.selectedIndex].value will give me the selected value (1,2 or 3) and e.options[e.selectedIndex].text would give me test1, test2, test3 depending on which is selected. Is it ok to use just e.value ? was this a problem in old browsers? which is more correct: e.value vs e

How to click on selectbox options using PhantomJS

左心房为你撑大大i 提交于 2019-11-30 21:21:14
There is the page testkrok.org.ua with a consistent selection of parameters. So, I need to create a series of 5 clicks on each of the options of 5 select boxes that depend on each other. document.querySelector('select.se1')[3] document.querySelector('select.se2')[1] document.querySelector('select.se3')[1] document.querySelector('select.se4')[1] document.querySelector('select.se5')[3] to redirect to the page with tests. But on snapshot taken after the first click the second panel does not appear? Maybe I don't hit the the element? var page = require('webpage').create(); page.open('https:/

CSS pseudo elements in select tag options in Internet Explorer

谁都会走 提交于 2019-11-30 19:59:16
I'm trying to add some CSS ::before content to the <option> tags of a <select multiple> depending on if the option is selected or not. The below is currently working fine in Chrome & FF, but I'm having issues in IE11. select > option::before { display: inline-block; width: 10em; } select > option:checked::before { content: "SELECTED: "; } select > option:not(:checked)::before { content: "excluded: " ; } <select multiple> <option value="1" selected="selected">1</option> <option value="2" selected="selected">2</option> <option value="3" selected="selected">3</option> <option value="4" selected=

How do I dynamically create an <option> in JavaScript that contains an HTML entity (— … «)?

陌路散爱 提交于 2019-11-30 19:01:25
I'd like to add an <option> element to a <select> element where the <option> element's text contains an HTML entity: — In HTML, the code would look like this: <select name="test" id="test"> <option value="">— Select One —</option> </select> My JavaScript code looks like this: function selectOne() { var e = document.getElementById('test'); e.options[0] = new Option('— Select One —', ''); } However, as you will see if you test this, the — becomes escaped. I had the same outcome when I tried: e.options[o].text = '— Select One —'; (Observed behavior was in Internet Explorer 7 ... did not test with

System.Data.DataRowView in DropDownList

天涯浪子 提交于 2019-11-30 18:11:21
问题 I am trying to populate a dropdown using values from a column. Now the problem is: I am not getting the actual values (the country codes like India(+61)) in the dropdown. Instead I am getting "System.Data.DataRowView" (multiple times) in the dropdown. public void bind() { DataSet ds1 = new DataSet(); SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]); con.Open(); string strQuery = "select CountryCode from AUser"; SqlCommand cmd =

Html.DropDownList selected value not working using ViewBag

偶尔善良 提交于 2019-11-30 17:38:10
问题 Well, after a couple hours reading stuff over here, trying unsuccessfully all the solutions, also found this article that i thought it would save my life... nothing. Long story short. Here is my View (all combinations) @Html.DropDownList("yearDropDown",(IEnumerable<SelectListItem>)ViewBag.yearDropDown) @Html.DropDownList("yearDropDownxxx",(IEnumerable<SelectListItem>)ViewBag.yearDropDown) @Html.DropDownList("yearDropDown",(<SelectList>)ViewBag.yearDropDown) @Html.DropDownList("yearDropDown")

html-select drop down issue with cordova on IOS 11 Beta

北城以北 提交于 2019-11-30 15:40:58
问题 I currently build an IOS application using AngularJS and Cordova. I find a bug when I tried my app on IOS 11 Beta. To select some data in a form, we use select dropDown. When we select a value, the drop down list disappears but it appear again some seconds after. When I have multiple select on my form, when a tap on a second select the first is selected. Then after selected the value the good list of option appear. I try with basic sample and this is the same behaviour. In a web explorer or

html-select drop down issue with cordova on IOS 11 Beta

北慕城南 提交于 2019-11-30 15:08:21
I currently build an IOS application using AngularJS and Cordova. I find a bug when I tried my app on IOS 11 Beta. To select some data in a form, we use select dropDown. When we select a value, the drop down list disappears but it appear again some seconds after. When I have multiple select on my form, when a tap on a second select the first is selected. Then after selected the value the good list of option appear. I try with basic sample and this is the same behaviour. In a web explorer or with IOS 10, there is no bug. <select ng-model="elements" ng-options="serie.nom for serie in elements"><

Get select element value on event using pure JavaScript

半腔热情 提交于 2019-11-30 12:09:10
I want to get the value of a select element when the select element is clicked! I want to do it without an onchange attribute in the HTML. I would like to achieve this without jQuery. I don't want to include a jQuery framework into this website when this tiny script is the only thing I need. var select_element = document.getElementById('product-form-user-enquiry-type'); select_element.onchange = function(e){ if (!e) var e = window.event; var svalue = select_element.value; alert( svalue ); } if ( select_element.captureEvents ){ select_element.captureEvents(Event.CHANGE); } The select_element