w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

Jtable options array for drop down list or select list
After much trial and error, and debugger stops in the jtable scripting files, I learned that in order to use an object for the 'options' property of a field in jtable, the object must be in the following format var optionsObject = new Object(); optionsObject[Value] = DisplayText;

Categories : List

html select control click not showing options list until mouse is hovered towards the options
it seems IE9 is blocking javascript...i hope this helps http://answers.microsoft.com/en-us/ie/forum/ie9-windows_vista/internet-explorer-9-drop-down-menus-do-not-pull-up/954c5c71-5878-40a4-b9f8-68991922e85a

Categories : Javascript

Getting List for Select tag from Map> based in iterator index
When iterating a map via the iterator tag var attribute is not necessary, because the current item pushed to the value stack on each iteration. So, referencing value attribute of the map entry as a list collection. <s:iterator value="listOne" status="stat"> <s:select name="col%{#stat.index}" listKey="KEY" listValue="VALUE" list="dynamicList['%{top}']" /> </s:iterator>

Categories : Java

How to remove/hide select options from select-list
Try to disable that option with disabled attribute. <select id="selectlist" name="selectproduct" > <option value=""> --- Select product --- </option> <option value="1">Product 1</option> <option value="2">Product 2</option> <option value="3">Product 3</option> <option value="4" disabled="disabled">Product 4</option> </select> Check demo

Categories : Javascript

Playframework get List of Objects as Options in select
Take a look into computer-database-jpa sample ie. options() method in Company model in general it returns Map<String, String>. As you can see in the editForm view, usage is pretty similar to your. Note: probably you Metaunit is connected with some M-M relation, in that case most probably you will need to use unitForm("metaunit.id") as a field's value

Categories : Java

How to change the current value of a select list bound with ng-options?
I've modified mb21's fiddle to get your code working and demonstrate initializing the values. http://jsfiddle.net/GCrU3/ The issue is, when you use ng-model on the select and ng-options for the options, you must set the ng-model variable to the exact reference of the object that is being used to generate that option: for(var j =0; j<selectedActions.length; j++){ selectedActions[j].value = userDevice.baseDevice.outputs[0]; // change index to select different initial value }

Categories : Javascript

Drupal fields: Programmatically insert select list options
Try Drupal Date module, if that does not have option then what you can do is create the form from the UI without 'select date element' that you want to do programatically. After that get the 'id' of the form by debugging the 'html source' of the form_id . Afterwards use hook_form_alter(&$form, & $form_state, $form_id) function my_form_alter(&$form, & $form_state, $form_id) { if ($form_id == 'MY_FORM_ID' ) { $date_key_format = "m/d/y"; ; $date_value_format = "F j, Y, g:i a"; $options = array(date($date_key_format) => date($date_value_format)); for ($i = 1; $i < 10; $i++ ) { $options[date($date_key_format, strtotime("+$i days"))] = date($date_value_format, strtotime("+$i days")) } $form['date'] = array ( '#type' => 'sel

Categories : PHP

Select Not showing the rest of options list when using jQuery Mobile
The winning answer is: $('#searchuniversitycampus').selectmenu({'refresh': true}); The refresh has to be done like this to have the list show! Got the answer from the following post

Categories : Jquery

Using jQuery, how can I create a select list using a page's H4 titles as options?
Iterate through each h4 tag and create an option for each one: $('h4').each(function() { $('select').append('<option value="' + $(this).text() + '">' + $(this).text() + '</option>'); });

Categories : Javascript

dynamically creating select elements and populating options from sharepoint list
The obvious first step is to refactor out the shared code. So: $(function () { // Temp test stuff to populate option list var selectObj = document.getElementById("combobox2") if (selectObj) { for (var i=0; i < csKeyword.length;++i){ addOption(selectObj, csKeyword[i], csKeyword[i]); } } }); ( ... etc ... ) becomes: function populate(id, collection) { var selectObj = document.getElementById(id) if (selectObj) { for (var i=0; i < collection.length;++i){ addOption(selectObj, collection[i], collection[i]); } } } $(function () { populate ("combobox1", csCategory); populate ("combobox2", csKeyword); populate ("combobox3", csEntity); }); I can't see any significant advantage at this stage of putting combobox1 and its sibli

Categories : C#

How can I filter select list options based on foreach observablearray property
<tbody data-bind="foreach: CertificateDetailsToShow"> <tr> <td> Loan: <span data-bind="text: LoanNum"></span> (<span data-bind="text: CurrType"></span>) <select data-bind="options: $parent.filter($parent.DDABankNums, $data.LoanNum), optionsText: 'AccountName', optionsValue: 'myDDABankNumValueAttributeName'"> </select> </td> </tr> </tbody> ViewModel contains this method: self.filter = function(ddaBankNums, loanNum) { return ddaBankNums().filter(function(ddaBankNum) { return ddaBankNum.mLoanNum == loanNum; }); }

Categories : Knockout Js

need to select options from list, sum values and display system (PDF or web page) that meets their needs
It is easiest to access form controls if they are in a form. Also, the value should be the value attribute of the checkbox to make it easier to add them up. Then you just need a simple function to loop over the checkboxes and get the total, e.g.: <script> function update(form) { var total = 0; var el; for (var i=0, iLen=form.elements.length; i<iLen; i++) { el = form.elements[i]; if (el.type == 'checkbox') { total += el.checked? +el.value : 0; } } form.total.value = total; } </script> <form onclick="update(this);"> <table width="200" border="1"> <tr> <th scope="col">Name</th> <th scope="col">Watts</th> <th scope="col">Offset?</th> </tr> <tr> <th scope="r

Categories : Javascript

What kind of List is List list = Database.getAllData();?
You don't have to know; that's the point. The interface is what matters to you, not the implementation. You can't know without looking at the source of that method. But even if you do, it's immaterial to your client. All you call are List methods.

Categories : Java

How can one populate an MVC select list according to selected item from another select list on the same view?
The "best" way is probably a matter of opinion, but a good way to do it is to use AJAX to populate the 2nd dropdown. Whereas the first dropdown can be populated with static data, the 2nd can be populated either by generating client-side JavaScript code that fills up the 2nd, or by doing an AJAX call to a Controller method that returns JSON, and then filling up the 2nd dropdown with that data. Here is a nice article about it: "Cascading Dropdown Lists with MVC 4 and jQuery" at http://www.sidecreative.com/Blog/Entry/Cascading-dropdown-lists-with-MVC4-and-jQuery. Good luck!

Categories : C#

jquery on certain option select on first select list, enable second select list
i Added this JS code: $("#decide").change(function () { $('#day').prop('disabled', false); }); Working Great in JSFiddle

Categories : Jquery

Excel: Display value from list of options if numbers begin with value from options
VLOOKUP() I believe is the right function for this. Assuming that you want the area names in column E in Sheet1 as from row 2, the phone numbers are in columnB of that same sheet and the table with prefix and area code in Sheet2 columns A and B, you can use: =VLOOKUP(LEFT(B2,5), Sheet2!A:B, 2, FALSE) LEFT(B2,5) extracts the first 5 characters from the phone number stored in B2. If there are area codes of different lengths, then the formula will have to be revised and it will be much more complex. Sheet2!A:B is the table to lookup the data 2 is the index of the column containing the values you want to get (the first index is the column containing the area codes) FALSE means exact match. I don't think you'd like to get the area code immediately smaller than the one you're looking for,

Categories : Excel

jQuery to automatically pre-select multiple options from several drop down lists based on user selection from another drop down list
The easiest way that comes to mind is the following: var positions = { QB : ['SPD', 'AGI', 'INJ', 'AWR', 'TPOW', 'ELUS', 'TACC', 'TDEP'], HB : ['SPD', 'AGI', 'ACC', 'AWR', 'CARY', 'TRCK', 'ELUS', 'BCV'], FB : ['SPD', 'AGI', 'AWR', 'TRCK', 'CTCH', 'RBST', 'RBFT', 'IMPB'] // fill in the rest of this object yourself } $('#position').change(function(){ // caching the selected value: var v = this.value, // retrieving the array stored under the relevant key: arr = positions[v], // getting all the select elements whose 'id' starts with the string: attribs = $('select[id^="attribute_type_"]'); // iterating each of those selects: $.each(attribs, function(i,v){ /* finding the 'option' whose value is equal to that stored in

Categories : Jquery

Take parameter, determine if its an object or list<>; if list<> then loop and treat each item as object
You could do something like this: public static Dictionary<string, object> Pick(object obj, Array Picklist) { Dictionary<string, object> dic = new Dictionary<string, object> (); IEnumerable items = obj as IEnumerable ?? new[] { obj }; foreach(string key in Picklist) { foreach(object item in items) { dic.Add(key, item.GetType().GetProperty(key).GetValue(item, null)); } } return dic; } Note however, this will fail if you actually try to provide two or more items, since it will attempt to add the same key to the dictionary twice. It will also fail if you try to pass an object which doesn't have one of the specified properties. It's unclear exactly what you want this method to do in these cases, but this code s

Categories : C#

Object reference error adding a new select list item
Probably You didn't initialized VideoList in the parameterless constructor of HammerpointVideoListModel class, so it is NOT an empty list. Put VideoList = new List<SelectedListItem>(); in the constructor.

Categories : C#

Appending the "selected" option in select list via jquery [timezone selection list]
there is a little bug in your function. use this code: $("#timezone option").each(function(){ if($(this).val() == response_text){ $(this).attr('selected','selected'); } }) Instead of this: for(var i=0;i<array.length;i++) { if (timez[i] === response_text) { $('#timezone').attr('selected') } } working code here: http://jsfiddle.net/HYfQ5/1/

Categories : Javascript

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 iterate through an unordered list and then select the parent div of the list item
$('.question').filter(function () { return ! $(this).find('input:checked').length; }).addClass('highlight'); Here's the fiddle: http://jsfiddle.net/XTDre/

Categories : Javascript

Python Object list keep changing when I change an other object list
Lose the class attributes. You are not using them anyway. In fact it's causing your bug because all the instances appear to share the same CHAN list class ircServer: def __init__(self, HOST, PORT): self.HOST = HOST self.PORT = PORT self.CHAN = [] def addChan(self, CHANEL): self.CHAN.append(CHANEL) Also consider reading PEP8 and following at least most of the guidelines there

Categories : Python

How to Iterating through an JSON Object and append an HTML input menu/list select
See this fiddle: http://jsfiddle.net/gCFM9/ I suggest this option: for(var i in data) { data[i] //each value of i position }

Categories : PHP

Select in LINQ all keys from List of List of KeyValuePairs
It sounds like you just need a combination of SelectMany, Select and Distinct: var allKeys = sourceData.SelectMany(list => list) // Flatten to a sequence of KVP .Select(kvp => kvp.Key) // Select just the keys .Distinct(); Note that if you want to iterate over allKeys more than once, you probably want to materialize the query, e.g. by calling ToList at the end: var allKeys = sourceData.SelectMany(list => list) // Flatten to a sequence of KVP .Select(kvp => kvp.Key) // Select just the keys .Distinct() .ToList();

Categories : C#

Getting List from View into Controller
You need to use the indexer istead of foreach statment to allow mvc to build your list back. The simmilar question has already been asked How to pass IEnumerable list to controller in MVC including checkbox state?

Categories : C#

Is there a way to print out an object from a script as it would appear in the REPL? (e.g. myList: List[String] = List(Hello there, World!)
The Scala equivalent of this would be the getClass method (from Java) on java.lang.Object. For instance: scala> 1.getClass res0: Class[Int] = int scala> Nil.getClass res1: Class[_ <: scala.collection.immutable.Nil.type] = class scala.collection.immutable.Nil$ scala> "hello".getClass res2: Class[_ <: String] = class java.lang.String

Categories : Scala

create a combo box dymically fom list in a viewmodel 9+ mvc
That's technically as easy as: @Html.DropDownList("FieldName", Model.civility.Select(m => new SelectListItem { Value = m, Text = m })); You'll end up with something akin to: <select id="FieldName" name="FieldName"> <option value="CivilityItem1">CivilityItem1</option> ... </select> If you want it tied to an actual property on your model (you'll need to add the property to your model first) @Html.DropDownListFor(m => m.SelectedCivility, Model.civility.Select(m => new SelectListItem { Value = m, Text = m }))

Categories : C#

How do i save a list of objects in my ViewModel using EF DB Context?
I just got back to my machine. Here is how you can acheive it, if you haven't already. My Action which renders the list public ActionResult Index() { List<Women> womens = new List<Women> { new Women { Id=1, FirstName = "Women1", LastName = "Lastname1" }, new Women { Id=2, FirstName = "Women2", LastName = "Lastname2" } }; WomenList womenList=new WomenList(); womenList.Womens = womens; return View(womenList); } The action where the list is posted.

Categories : C#

send a ViewModel which contains a list with a Html.BeginForm (MVC 4)
for(int i=0;i<nbre ;i++) { montest.itemTest.Add(0); } return View(montest); Looks like you are filling your int array with zeroes instead of i's. This should read montest.itemTest.Add(i); .

Categories : Asp Net Mvc

How to parse String List into List using Gson
Your getGenericClass() won't work, you need to retrieve the class of T. You can provide it : Class<T> type; public Class<T> getType() { return this.type; } or get it at runtime (unsafe, you can find many post on this subjet I think) public Class<T> getType() { return (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; } Then to build the list token you can use this code : static TypeToken<?> getGenToken(final Class<?> raw, final Class<?> gen) throws Exception { Constructor<ParameterizedTypeImpl> constr = ParameterizedTypeImpl.class.getDeclaredConstructor(Class.class, Type[].class, Type.class); constr.setAccessible(true); ParameterizedTypeImpl paramType = cons

Categories : List

AutoMapper for a list scenario only seems to repeat mapping the first object in the list
For anyone else with this problem, it appears as if the documentation was not working for me. A colleague made the following suggestion: userSearchModel.UserList = UserEvent.Select(item => Mapper.Map<User, UserListModel>(item)); It worked like a charm.

Categories : C#

When I access a list on an object it incorrectly returns as empty list
You replace the neighbours parameter with an empty list def __init__(self, (x,y,z), n, radius, neighbours): neighbours = [] # <- HERE self.neighbours = neighbours Remove that line, and you should be able to access the neighbour list.

Categories : Python

Append different object into list but the list result in same objects repeating
Whenever you call neighbor_list.append(neighbor) you just add a reference to neighbor, rather than a new list. This means that every list in neighbor_list is just the current value of neighbor. To fix this, you should make a copy of the list like this: neighbor_list.append(copy.copy(neighbor) Documentation for copy

Categories : Python

Using C# LINQ to concat a filtered List to List
If names is empty, what you're meant to do is this: var names = businessNames.Select(item => item.Name).ToList(); Another option is to use the List<T>'s ConvertAll method, like so: var names = buisnessNames.ConvertAll(item => item.Name); However, if it may be not empty, you'd need to use an if statement too: var names = new List<string>(); //some code if (names.Any()) names.AddRange(/*your selected method*/); else names = //your selected method;

Categories : C#

How to creat a new list from existing list with elements which contains the same id in Linq to object?
list.GroupBy(x => new { x.RefId, x.RefName }) .Select(g => new TestNew() { RefId = g.Key.RefId, RefName = g.Key.RefName, ListGroup = g.Select(y => new Group() { ID = y.ID, Name = y.Name }).ToList() }).ToList();

Categories : C#

How to short*cirtcuit [] to create a list-like object instead of the standard list ? Is it even possible?
As stated here, python doesn't allow you to override its syntax. Although, this answer contains a hack that might help you (probably not).

Categories : Python

Sorted/unique list of object instances from a larger list?
One way to do this is using itertools.groupby(): import itertools x3 = [next(g) for k, g in itertools.groupby(x2, lambda x:(x.a, x.b))] This picks the first element of each group with the same key.

Categories : Python

Error converting an object list to tag list with dynamic UI in shiny
I would guess one problem is that the plot_output_list should not be indexed by strings, but instead by number, i.e. plot_output_list[[symbol]] <- ... should be plot_output_list[[i]] <- ...; i <- i + 1 If that doesn't work, try running traceback() right after you hit the error so we can see where the error comes from.

Categories : R



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