w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Dynamic drop down list - SelectedValue which is invalid because it does not exist in the list of items
You have set the SelectedValue to -1 which must exist. Don't confuse it with the SelectedIndex where -1 indicates that nothing should be selected. So i assume that you actually want: ' ... modelDD.Items.Clear() modelDD.SelectedIndex = -1 ' instead of SelectedValue = -1 ' ...

Categories : Asp Net

How to select multiple items from dropdown list, save it and again repopulate the dropdown with the selected list?
The default DropDown helper that is provide in asp.net mvc does not support multiselet. You'll have to create your own custom multiselect dropdown helper. Here are some links that can help you create you own custom dropdown helper: http://blogs.msdn.com/b/rickandy/archive/2012/01/30/asp-net-mvc-dropdownlist-multiselect-and-jquery.aspx http://utsavized.com/chosen-multiselect-dropdown-list-with-asp-net-mvc3/

Categories : Asp Net Mvc

How to get all the items of a dropdown list to gridview?
You need a loop: DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Country", typeof(string))); foreach(ListItem item in DDLCountry.Items) { DataRow dr = dt.NewRow(); dr.SetField("Country",item .Text); dt.Rows.Add(dr); } Grd1.DataSource = dt; Grd1.DataBind(); or the minimized version: DataTable dt = new DataTable(); dt.Columns.Add("Country"); // string is default foreach (string country in DDLCountry.Items.Cast<ListItem>().Select(i => i.Text)) dt.Rows.Add(country);

Categories : Asp Net

Items are not showing in dropdown list using servlet
Can you please post your errors, you are getting? That will help us in finding the issues. I have tried creating same structure and implement servlet and then having values in dropdown and its working. Below is the code i have tried, DDBIRFormNo servlet public class DDBIRFormNo extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<TblBIRFormNo> birtypelist = this.getAllBirFormNumber(); request.setAttribute("birtypelist", birtypelist); request.getRequestDispatcher("/WEB-INF/rcmoduleIssue-eReceipt-ROR.jsp").forward(request, response); } private List<TblBIRFormNo> getAllBirFormN

Categories : Java

Spring MVC form - No items in dropdown list?
I can see from your code that , if your form has error then it is simply returning "ApplicationForm" view Name with no Model data exposed to view which view will display if(result.hasErrors()){ System.out.println("It has some errors !!!!!!!!"); return "ApplicationForm"; }

Categories : Java

How do i add items from a dropdown list then get the text of each item
Without using jQuery: var selectDom = document.getElementById("blahBlah"); var optionsDom = selectDom.getElementsByTagName("option"); var optionsArray = Array.prototype.slice.call(optionsDom); var theArrayThatYouWant = optionsArray.map(function(option) { return option.text });

Categories : Java

search items in database and display dropdown list
You need to implement AutoCompleteTextView. This allows suggestions as the user is typing. You can bind the data to be searched for, using Adapters. This should solve your problem. An example that might be helpful can be found here.

Categories : Android

Show/Hide dropdown list values from other dropdown list value changed
There are a lot of options, but you shouldn't start with the items hard-coded in your markup. Quick solution: Have a private List<string> variables set up for each of the collections of numbers (I say string instead of int because ListItems will be converted to strings). So for instance, private List<string> personalLoanIds = new List<string> () {"12", "24"}; When ddlLoanType is changed to Personal Loan, you can set your ddlDuration's DataSource to personalLoanIds then call the DataBind() method.

Categories : C#

Add search box in Twitter's Bootstrap Button dropdown list to select the items
Bootstrap 3 Typeahead is removed in Bootstrap 3 so instead use http://github.com/twitter/typeahead.js. Example on: http://bootply.com/69994 Javascript: var items = new Array(); $( ".dropdown-menu li a.hc" ).each(function( index ) { items.push( $(this).text() ); }); $('.dropdown-menu input').click(function(){return false;}); //prevent menu hide $('.typeahead').typeahead( { name: 'items', local: items } ).on('typeahead:selected', function(obj, datum) { if($('a.hc').filter(function(index) { return $(this).text() === datum.value; })) { //alert('redirect to: ' + $('a.hc').filter(function(index) { return $(this).text() === datum.value; }).attr('h

Categories : Twitter

Populate dropdown list by another dropdown list in django with formsets
I had a similar problem related to populating drop down menus in a formset based on a user selection (which could be multiple rows in a table). What worked for me was to modify the base_fields in the formset before I put the selected rows in the formset like so: formset = modelformset_factory(mymodel) formset.form.base_fields['my_parameter'] = forms.ChoiceField(choices=getMyParamChoices()) finalformset = formset(queryset=model.objects.filter(id__in=request.POST.getlist('selection') 'selection' is the list of selected rows from the previous page. getMyParamChoices() is a function that queries a model to get the list of pulldown choices like so: def getMyParamChoices(): '''Go get the list of names for the drop down list.''' all = anothermodel.objects.all() params = [] for item in all:

Categories : Django

Dropdown select list won't display items with custom forms of Zurb Foundation 4 and Rails 4
Ok, so I just figured out that I have repeated asset load on my browser. This is causing a javascript error. It appears that deleting in the manifest //= require turbolinks Solves the problem. I solved my multiple asset problem changing <%= javascript_include_tag "application" %> To the head in my application layout. After watching the turbolinks railscast I noticed that besides my multiple asset loading, turbolinks and foundation 4 may not be compatible, it might be a solution on this post. But still doesn't work perfect for me. I also noticed that navbar is also affected by turbolinks. I think that this is rather a turbolinks problem and not an specific foundation dropdown. I will close this question and open a new on turbolinks and foundation.

Categories : Ruby On Rails

jQuery replacing list items with different list items with specific classes
You don't have to use .load there, If, classes are already there, you don't have to do anything - Simply remove this Line $(this).load("li a.add-this-list-on-click-instead > *").fadeIn("slow"); and if .add-this-list-on-click-instead are hidden initially - then just make it visible with this - $("#dynamic").click(function() { $this = $(this); var refreshId = setInterval(function() { $('.remove-this-list-on-click').fadeOut("slow", function () { $this.find("a.add-this-list-on-click-instead").fadeIn("slow"); }); }); });

Categories : Jquery

Adding Sharepoint 2010 List Items to a List with external Items
One option is to create an SQL server trigger. This trigger would fire whenever a new sales order is created in your source database. You could make it a CLR trigger, and in the function make use of the SharePoint client interface. After you provided a clearer description of the problem: I believe that you're looking for something like the list event handler. This will run on the events you care about, and you can pull from the database at the appropriate time. Essentially, you need to make a Visual Studio SharePoint project (from my past experience this method requires you to use VS right on the SharePoint server, or else you have to copy a lot of DLLs manually from the server); and make an event receiver.

Categories : SQL

WPF Binding Combox with different List and different SelectedValue
Use a Dictionary. XAML <ComboBox ItemsSource="{Binding Dict}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding Prop}"/> Code Behind public Dictionary< ValueType, string > Dict { get; private set; } private ValueType _prop; public ValueType Prop { get{ return _prop } set { _prop = value; NotifyPropertyChanged( "Prop" ); // Implement INotifyPropertyChanged } } public ViewModel() { Dict = new Dictionary< ValueType, string >() { { value1, string1 }, { value2, string2 }, { value3, string3 } }; }

Categories : C#

Find list index of list items within other list items
Maybe something like?: my_list = ['abc-123', 'def-456', 'ghi-789', 'abc-456'] things_to_find = ['abc', 'def'] for n, e in enumerate(my_list): for m in things_to_find: if m in e: print '%s is in %s at %s' % (m, e, n) Output: abc is in abc-123 at 0 def is in def-456 at 1 abc is in abc-456 at 3

Categories : Python

Select items from a List where the children contain the items from another List using LINQ
If you want to return all the products which has all the provided categories in its Categories which means it selects product where it has category1 AND category2. Then you need to use the All with the combination of Contains: public List<Product> FilterProducts(List<Category> categories) { return products.Where(p => categories.All(c => p.Categories.Contains(c)) .ToList(); } If you want to return all the product where it has it least one cetegory from the provided categories which means it selects product where it has category1 OR category2. Then you need to use Any public List<Product> FilterProducts(List<Category> categories) { return products.Where(p => categories.Any(c => p.Categories.Contains(c)

Categories : C#

when selecting a value from a dropdown list set other dropdown list to it's default value
Here is a idea to start. Consider 2 dropdown like this. <select id="Numeric"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <select id="Alphabets"> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> </select> Based on the value of 1st dropdown i am selecting the second dropdown var val = document.getElementById("Numeric").value; var obj = document.getElementById("Alphabets"); if(val == "1") obj.value = "A" else if(val == "2") obj.value = "B" else if(val == "3") obj.value = "C" Switch is more better switch(val) { case("1"): obj.value = "A"; break; case("2"): obj

Categories : PHP

How can i populate a dropdown list by selecting the value from another dropdown list
$(function() { $('#first_select').change(function() { value = $(this).val(); $("#second_select").append('<option value=" + value + ">' + value + '</option>'); }) })

Categories : PHP

Print search term that does not exist in list comprehension of a list comprension
You could try this, which is a bit more of a pythonic version of your loop and conditional: import re resourceProperties = 'test test token test' rpAttrs = [['ajgagag', 'knkagga'], ['token', 'knkagga'], ['ajgagag', 'knkagga']] print(' '.join(value[0] for value in rpAttrs if not list(re.finditer(value[0], resourceProperties)))) This outputs: ajgagag ajgagag

Categories : Python

how to select value by default in dropdown list when use viewdata["Country"] and get get list from database
You seem to be binding the dropdown to a complex property on your model (Country) which obviously is not supported. Dropdowns should be bound only to simple scalar type properties. So you should define a property that will hold the selected value on your EventObject view model: public string SelectedCountry { get; set; } Then in your controller action you should set this property to the value of the country you want to be preselected: using (Country objContry = new Country()) { ViewData["Countries"] = new SelectList(objContry.GetAllCountry(), "Country", "Country"); } lst[0].SelectedCountry = "Argentina"; return View(lst[0]); and in your view: @Html.DropDownListFor( model => model.SelectedCountry, (SelectList)ViewData["Country"], new { id = "ddlCountry" } ) I

Categories : Asp Net Mvc

How to show inner content in list item outside of that list item without being covered up by descending list items
You must set the z-index of the clicked 'li' higher and in return the former clicked 'li' back. Here is the example: fiddle And here the script: var oldli; $('li').click( function(){ $(oldli).toggleClass('displayNone displayBlock'); $(oldli).css("z-index","1"); $(this).toggleClass('displayBlock displayNone'); $(this).css("z-index","5"); oldli=$(this); } );

Categories : Javascript

Linq - How to select items from a list that contains only items of another list?
This returns the items which all states are in stateList, I think that that's what you need: Items.Where(x => x.TestList.All(s => stateList.Contains(s.State)));

Categories : C#

dropdown list on showing selected item from list
Just set your Dropdown Auto AutoPostBack to False. <asp:DropDownList ID="DropDown" runat="server" DataTextField="DisplayName" DataValueField="ID" AutoPostBack="False" DataSourceID="Sections"> </asp:DropDownList> <asp:SqlDataSource ID="Sections" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnection %>" SelectCommand="SELECT e.DisplayName, e.ID , e.GUID FROM .. e INNER JOIN .. re ON e.ID = re.anID AND re.otherID = 1"> </asp:SqlDataSource> Check this Url based on your new query: Populate one dropdownlist based upon action of another dropdownlist Best Regards

Categories : C#

conditionally adding multiple items to a list of lists via python list comprehension
The line html = BeautifulSoup(urllib2.urlopen('http://domain.com').read(), 'lxml') implies you have lxml installed, so you could use an XPath using | to pull out text or attribute values: import urllib2 import lxml.html as LH html = LH.parse(urllib2.urlopen('http://domain.com')) clean_data = [[elt for elt in tr.xpath('td/a/text() | td/a/@href | td/text()')] for tr in html.xpath('//table[@id="targeted_table"]/tr')] print(clean_data) yields [['http://domain.com', 'data 01', 'data 02', 'data 03', 'data 04'], ['http://domain.com', 'data 11', 'data 12', 'data 13', 'data 14'], ['http://domain.com', 'data 01', 'data 22', 'data 23', 'data 24'], ['http://domain.com', 'data 01', 'data 32', 'data 33', 'data 34']] You could also do it with a single call to the xpath met

Categories : Python

Adding checked items in a custom list view to array list in android
initialize the "ArrayList" ArrayList<List> selectedItems; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_page); selectedItems = new ArrayList<List>(); }

Categories : Android

Counting visible list items and then applying class to nth item of that list in jQuery?
Use $.each to iterate over the elements and then apply the logic. var $elems = $('.row-fluid ul.thumbnails li:visible'); $elems.each(function() { var $this = $(this); if($this.hasClass('span3')) { $this.filter(':nth-child(4n + 5)').addClass('span-left'); } else if($this.hasClass('span4')) { $this.filter(':nth-child(3n + 4)').addClass('span-left'); } else if($this.hasClass('span6')) { $this.filter(':nth-child(2n + 3)').addClass('span-left'); } });

Categories : Jquery

Make check box items indent like an unorderded list inside a list?
Without more info it's difficult to figure out what you want, but I think this may come very close. Just give the labels for the checkboxes display:block. And some cosmetics to make it look right. li label {display:inline-block; max-width:80%; vertical-align:top} See http://jsfiddle.net/MrLister/6VyL6/1 If that's not what you're after, you may have to show some code of your own.

Categories : HTML

Selenium adding items from a Web element list to a string array list
Please try using following sample code, change xpath/data accordingly List<WebElement> resultList = _driver.findElements(By.xpath("//img[contains(@src,'tab-close.png')]/preceding-sibling::span[@class='tab-name ng-binding']")); for (WebElement resultItem : resultList){ String tabname=resultItem.getText(); if(resultItem.getText().equalsIgnoreCase("Dashboard")){ GlobalFunctions.clickOnButtonCustomised(false, _driver, By.xpath("//span[@class='tab-name ng-binding' and contains(text(),'"+tabname+"')]/following-sibling::img[contains(@src,'tab-close.png')]"), ""); } }

Categories : Java

knockoutjs - How to Create a List style app in with entry before adding list items
You are in fact very close to making it work. The problem was that you did not define the donationAmount observable property in the main view model, which resulted in KnockoutJS failing when binding this unavailable property to the input tag. Here is the part of the code that had to be changed so that it works now: function DonationsViewModel() { var self = this; self.donationAmount = ko.observable(); // .... } and here's some little change to your HTML: <div> <select data-bind="options: availableDonations, optionsCaption: 'Please select...', value: selectedDonation, optionsText: 'label'"></select> <input data-bind="value: donationAmount"/> <button typ="button" data-bind="click: addDonation">Add Donation<

Categories : Knockout Js

Generate unique list item id for all list items in site collection
There is no comparable feature to the documentID service for Items in general out of the box. You would have to build it using Custom code. You can create a custom ID which appends the list GUID and the OOTB item ID which is unique to every item in the site collection.

Categories : Sharepoint

Adding specific items from a list to a new list, index out of range error
The simple fix is to wrap your append in a try catch statement. for item in stock_data: try: closing_prices.append(stock_data[count]) except IndexError: break print (closing_prices) count = count + 6 the reason you are getting to the error is that when you get to the 5th to the last item in the list then add 6 to it you are now out of range of the lists maximum index so to speak. Another possible solution is to use a while loop. closing_prices = [] count = 10 while count < len(stock_data): closing_prices.append(stock_data[count]) count += 6 print closing_prices

Categories : Python

How can I apply a transition onto a list element and make it grow without affecting its background image or the other list items?
I think you just need to reduce the margin top value and the margin bottom value on the #facebook:hover css rule: #nav ul li#facebook:hover{ background-color:#2a4887; padding:5px; margin-left:10px; margin-right:-5px; margin-top:-15px; margin-bottom:0px; } See this fiddle: http://jsfiddle.net/jessekinsman/wgLWT/3/ Not sure if this is what you were trying to get at though. They are lining up at the bottom and the other elements are not moving.

Categories : HTML

Filtering out items from a list using nested list comprehensions in Python
You got the order mixed up: [sentence for sentence in sentences for word in words if banned_word not in sentence] Not that that'll work as that'll list the sentence every time a banned word does show up in the sentence. Take a look at the fully expanded nested loops version: for sentence in sentences: for word in words: if banned_word not in sentence: result.append(sentence) Use the any() function to test for banned words instead: [sentence for sentence in sentences if not any(banned_word in sentence for banned_word in words)] any() loops over the generator expression only until a True value is found; it'll stop doing work the moment a banned word is found in the sentence. This is more efficient at least.

Categories : Python

delete items from a list that equals to index of other list item
checkboxtry this: <ul id="listone"> <li><input type="checkbox" class='chk' value="item1"/>item 1</li> <li><input type="checkbox" class='chk' value="item2"/>item 2</li> <li><input type="checkbox" class='chk' value="item3"/>item 3</li> </ul> <ul id="listtwo"> <li class="list_item1">item 1</li> <li class="list_item2">item 2</li> <li class="list_item3">item 3</li> </ul> <ul id="listThree"> <li class="list_item1">other item 1</li> <li class="list_item2">other item 2</li> <li class="list_item3">other item 3</li> </ul> $(".chk").click(function () { var isChecked = $(this).is(':checked'); if (!isChecked) {

Categories : Javascript

Should adding a new item to a list<> update previous items in the list?
You're not adding several different items to the list, you're adding the same exact item several times and modifying it each time. Classes in C# are reference types; that means each variable doesn't hold the data for the object itself, it just hold onto a reference to where that object is. Assigning an object to another variable doesn't create a new object, it just copies the reference to that same object. The issue is that you should be creating a new object (i.e. using the new keyword) each time you go to add a new item to the list. From the looks of your code it would seem that StaticLists.GetStockMultibuyForBarcode(sBarcode) isn't returning a new item each time; it's just returning the same item, or at the very least one of the existing items. You should be creating a new item, co

Categories : C#

Make a list out of items in a sublist of a multidimensional list (python)
Using a list comprehension: L = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] M = [y for [x, y, z] in L]

Categories : Python

Make a list containing distinct list items from dataset containing duplicates
Since Dictionary won't allow for duplicate entries (it throws an ArgumentException was unhandled exception), thus handling the "heavy lifting" of ensuring uniqueness and sequence order (still testing that one). I think I'm using GSI.Sequence wrong because there could be multiple sequences for receipe items. (This is NOT the answer, but a place I could put code. I hope I did it right) Hat tip to http://williablog.net/williablog/post/2011/08/30/Generic-AddOrUpdate-Extension-for-IDictionary.aspx while(reader.Read()) { RecipeItems GSI = new RecipeItems(); GSI.RecipeItem = reader[0].ToString(); GSI.Sequence = Convert.ToInt32(reader[1].ToString()); GSI.RecipeName = reader[2].ToString();

Categories : C#

Find duplicate items within a list of list of tuples Python
Update: After rereading your question, it appears that you're trying to create equivalence classes, rather than collecting values for keys. If [[(1, 2), (3, 4), (2, 3)]] should become [(1, 2, 3, 4)] , then you're going to need to interpret your input as a graph and apply a connected components algorithm. You could turn your data structure into an adjacency list representation and traverse it with a breadth-first or depth-first search, or iterate over your list and build disjoint sets. In either case, your code is going to suddenly involve a lot of graph-related complexity, and it'll be hard to provide any output ordering guarantees based on the order of the input. Here's an algorithm based on a breadth-first search: import collections # build an adjacency list representation of you

Categories : Python

set list of object as dropdown list datasource
Like this: dropdownList.DataSource = GetAllCategories(); dropdownList.DateTextField= "CategoryName"; dropdownList.DataValueField = "JobCategoryid"; dropdownList.DataBind();

Categories : Asp Net

Linq how to query a list of items for a combined list of a child collection based on a property of the parent item
You may just want to group the invoice headers by the group: var groups = invoiceHeader.GroupBy(ih => ih.Group); Then you can access the lines of the groups: foreach(var group in groups) { Console.WriteLine("Group " + group.Group); Console.WriteLine("Lines:"); Console.WriteLine(string.Join(", ", group.SelectMany(h => h.InvoiceHeader.InvoiceLines))); } Output would be something like Group A Lines: invoice1, invoice2, invoice3, invoice4 Group B Lines: invoice5, invoice6, invoice7, invoice8

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.