w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to pass jQuery dropdown selected change value as a parameter from view file to controller
i am not sure i understand the question that well. if you are doing ajax posting and dynamic updating of the form, you may want to consider using the json_encode (php) and $.parseJson (jQuery) to send the parameters back to the client. that way you can send a ready-made html straight to the browser id. The cities function in javascript is a bit confusing to me. the parameters are: success:function (data, textStatus, jqXHR) the ajax.post function parameters are: jQuery.post( url [, data ] [, success(data, textStatus, jqXHR) ] [, dataType ] ) so, the data is something like: var data = {product_id:$('#product_id').val()}; this will send the data through as a POST variable, instead of as a GET variable as is the case in your code. some comments: in the view, end the change the line:

Categories : Jquery

Get a list option value from an auto populated JSON list and pass to JS function
Seems I needed to use :selected console.log($('#meh :selected').text()); Example: http://jsfiddle.net/764W9/8/

Categories : Javascript

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#

Passing whole object instance (that contains an empty List) from View -> Controller results in List.Count==1 in Controller
Use explicit for loop instead of a foreach loop, and reference your elements by their index Have a look at this: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx It's a bit old but still applies.

Categories : Asp Net Mvc

JQuery dropdown list selected item
js $(document).ready(function () { loc = $(location).attr('href'); var n = loc.split("/"); var n1 = loc.split("/").length; var on_page = n[n1 - 1]; var new_page = on_page.split("?"); $('nav ul a').each(function () { if ($(this).attr('href') == new_page[0]) { $(this).find('li').addClass('active'); } }); }); css .active { background:#ffca00; color:#2e2f34; padding:16px 12px; } Another code if you are working with # in the href js $(document).ready(function () { $('nav ul li').click(function () { $(this).parent().parent().find('.active').removeClass('active'); $(this).addClass('active'); }); }); Working Demo http://jsfiddle.net/XEy4s/

Categories : Jquery

Get the selected item of dropdown list from code behind
Your Select input which you add some options with JQuery to it, it is a Client side object and in no circumstances you can have access to it using code behind To access this object you have to add to property to your select input ID and runat=server thsese to property let you access your object from the code behind, you final select should be something like this <select id="select1" runat="server"> <option value="val1">dfgbfbff</option> </select> then in your code behind you can check its values with checking the select1

Categories : Asp Net

How to pass the selected value of dropdown list from xhtml page to jsf bean?
This is a very basic JSF point, in your selectOneMenu component, define a value in your managed bean: <h:selectOneMenu value="#{events.currency}" > <f:selectItem itemValue="choose" itemLabel="Seçiniz..." /> <f:selectItem itemValue="tl" itemLabel="Türk Lirası(TL)" /> <f:selectItem itemValue="usd" itemLabel="Amerikan Doları(USD)" /> <f:selectItem itemValue="euro" itemLabel="Euro" /> </h:selectOneMenu> Now in your managed bean, you just define a property currency: private String currency; public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } Now in your Events managed bean's method createAccount you just use the defined currency value. Please refer t

Categories : Java

What event fires when item in HTML select/dropdown list is selected?
You need to use change event $('#platypusDropDown').change(function () { var selection = this.value; //grab the value selected $.getJSON('platypus.json', selection, data() { . . . }); }); Fiddle Plus $('platypusDropDown').val here val should be val() and you dont need to create a jquery object again over the element, this inside the handler represents DOM element (select on which the event is bound to) and you can directly access the value with this.value or $(this).val()

Categories : Javascript

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

Show SQLite data by clicking list item in a list populated by the Database
You need to change focusable mode of your TextView to false update TextView in XML android:focusable="false" lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position, long id) { data.moveToPosition(position); Toast.makeText(getApplicationContext(), c.getString(c.getColumnIndex("notes")), Toast.LENGTH_LONG).show(); speakOut(c.getString(c.getColumnIndex(BaseColumns._ID))); } });

Categories : Android

How to access a user selected item from a dropdown list that is within a fieldset and a content template in asp.net using c#
Not sure if this is what you expect, but you can create an event handler. protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { var item =((DropDownList)sender).SelectedItem; } Not sure if code is correct but this is an idea.

Categories : C#

How do I render a partial view based on the list item a user clicked on?
The simplest way could be to use some javascript to copy the drop down selected value inside a hidden field of your partial view then simulate a click of one of your partial view (hidden) submit button. partial view: <table class="table" style="table-layout: fixed"> <input type="hidden" id="MyHiddenInput" name="selectedValue" /> @foreach (var item in Model) { <tr> <td style="vertical-align: top; width: 70px"> @item.AnnouncmentDate.ToShortDateString() </td> <td> <strong>@item.Title</strong><br /> @item.Announcment </td> </tr> } <div style="display: none;"><input type="submit" id="myHiddenButton" /></div> Parent view: <ul cla

Categories : Asp Net

How can I get info about the list View Item selected
You should modify this part of code to put name of image to its Tag property: foreach (string imageFile in files) { try { System.Drawing.Image myImage = Image.FromFile(imageFile); myImage.Tag="image name for each item";//you can put for example image file name myImageList.Images.Add(myImage); myImage.Dispose(); } catch { } } then when you want to get selected image's name you can use this code: private void imageListView_Clicked(object sender, EventArgs e) { String imgName= (String)imageListView.SelectedItems[0].ImageList.Images[0].Tag; }

Categories : C#

Show selected item in list view
adapter.getView(position, null, null) creates a new view, and not return view which is used in listView. You can try to get listView and get its child by position. Smth like that: lvList.getChildAt(position).setBackgroundColor(color.holo_orange_dark); But I think it's not the right way, because ListView can recreate view at any time. So the right way is adapter..

Categories : Android

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#

codeingiter - pass two json values from model to dropdown list in view
May be you need this, in your model make this change: if($query->num_rows > 0){ foreach ($query->result_array() as $row){ $arr = array( "address"=>htmlentities(stripslashes($row['address'])), "idDelAddress"=>htmlentities(stripslashes($row['idDelAddress'])) ); $row_set[] = $arr; //$row_set[] = htmlentities(stripslashes($row['address'])); //$row_set[] = htmlentities(stripslashes($row['idDelAddress'])); //I added this for second field. correct? } return $row_set; } Now in your javascript where you loop, do something like this: $(jQuery.parseJSON(JSON.stringify(result))).each(function() { $("#deliveryaddress").append('<option value="'+this.idDelAddress+'">'+

Categories : Jquery

Adding Right-Click option to List View per-item only on selected Items
You have to do this yourself. It's a bit of a pain. Basic flow is this... Create a global boolean called contextMenuAllowed. Subscribe to MouseDown event for the ListView. Do a HitTest on the ListView using the coordinates of the mouse (e.X and e.Y). If they hit on an item AND it was a right click, set contextMenuAllowed to true. Subscribe to MouseUp event for the ListView. If it is the right mouse button, set contextMenuAllowed to false. Subscribe to Opening event for the ContextMenu/ContextMenuStrip. If contextMenuAllowed is false, set e.Cancel to true and return. This is stop the context menu from actually opening. It's a bit of a pain but easily done and the user will never know the difference. Here is an example where I just made a new custom control that will do exactly what you

Categories : C#

How to pass a list of string as a parameter after grouping them in SSRS?
The issue with your parameter may be it's AVAILABLE or Default values being not set correctly if you are getting the first indexed item in an array. EG: If I set up a parameter to go with me and it is super simple like: declare @Temp table ( id int, Name varchar(8) ) insert into @Temp values (1, 'A'), (1, 'B'), (2, 'C'); Select Id , Name from @Temp If I have a grouping that is having subreports and other things it may be setting only one value EVEN if it is allowing multiple. If you want your parameter to be agnostic of scope(meaning it does not care where in the report it is to determine values). You can set it's available values and default values to be 'get values from a query' and set up a dataset met to only ever return the same static values it will only get those values

Categories : Arrays

Python list manipulation: Add an item to a string element to make it a 2 item list
Modify a[0]: >>> a = ['spam', 'eggs', 100, 1234] >>> a[0] = [a[0], 'Devon'] >>> a [['spam', 'Devon'], 'eggs', 100, 1234] For your updated question: >>> items = ['devon', 'baloney'] >>> a = ['spam', 'eggs', 100, 1234] >>> a[0] = [a[0]] + items >>> a [['spam', 'devon', 'baloney'], 'eggs', 100, 1234] If you're not sure about the position of 'spam' then use a list comprehension: >>> a = ['spam', 'eggs', 100, 1234] >>> [item if item != 'spam' else [item, 'devon'] for item in a] [['spam', 'devon'], 'eggs', 100, 1234]

Categories : Python

Rails: render partial with selected controller and action in view
Try this instead: <%= render :template => "workorders/index2" %> source: http://stackoverflow.com/a/6051812/2128691 edit: in response to your last comment... I haven't really worked with bootstrap, but maybe you could do something like this [pseudocode]: def home if [x condition] redirect_to index_seven_path else render :action => [y action] end end

Categories : Ruby On Rails

How to pass the data from controller action to partial view...?
What you're trying to do isn't going to work because the partial view is rendered before the knockout bindings are applied, but you want to pass knockout data to the partial view. The flow you should follow is this: Render Main Page with placeholder for partial view result Create ko viewModel and applyBindings ajax call for to Action that returns a PartialView Place the result in the placeholder This means that your main page shouldn't have any @Html.Partial() referring to the partial view you want to render, because that's rendered before knockout can run. <!-- Start: Modal --> <div id="modalPlaceHolder"></div> <!-- End: Modal --> self.getModalProductInfo = function (product) { alert("Get Product Info - for ID:" + product.ProductId);

Categories : Javascript

How to pass a parameter from view to controller
In your stats action, assuming you have a Repository model and the record containing name exists in your database. @repository = Repository.find(params[:repository_id]) @repository.name If not, you could pass it along with everything else, <%= link_to l(:label_statistics), {:action => 'stats', :id => @project, :repository_id => @repository.identifier_param, :repository_name => @repository.name}, :class => 'icon icon-stats' if @repository.supports_all_revisions? %> Then in the controller, access it via params[:repository_name]

Categories : Ruby On Rails

How to pass a List of objects from a controller to a view and access the properties of every objects?
Have you tried: <select> @foreach (var contact in ViewBag.ListeContacts) { <option>@Html.DisplayName(contact["nom_contact"].ToString())</option> } </select> It looks like you have a list of Contact and you are trying to get a DataRow from the collection? EDIT: Also make sure the property you are referencing exists, i.e. nom_contact

Categories : Asp Net

How to select first item of a list in and render the page during initial load for the first selected item
That's easy. in your AssetSummaryPageModel-Bean you will add a new method with the @PostConstruct annotation so it will be called after the bean has been constructed. In this method you will set selectedSensorId to the first item of your childFacilitySelectionList. When your page is being rendered, JSF will see that a value was already selected and will set this one as the selected one. @PostConstruct public void init() { selectedSensorId = childFacilitySelectionList.get(0); }

Categories : JSF

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

Forwarding the partial view's details to HttpPost method of a controller when button in partial view is clicked
Have you tried this? @using(Html.BeginForm("Add", "AddCredit")) { @Html.HiddenFor(m=>m.CreditBalanceId) <div class="input-small" id="credit">@Html.EditorFor(m=>m.CreditToAdd) </div> <button type="submit" class="btn">Add Credit</button> }

Categories : HTML

dropdown list bound to array using AngularJS not updating instantly when array is populated
Sounds like a typical outside-digest-cycle problem. Right after you get the countries make sure you call $scope.$apply(), or wrap the request (jQuery or whatever) around $scope.$apply(function() {....});

Categories : Angularjs

How to add List containing item of type List ,int,string into another List
Use the power of LINQ: var B = A.GroupBy(x => new { x.Name, x.EngineType }) .Select(g => new Car { Name = g.Key.Name, EngineType = g.Key.EngineType, Months = g.SelectMany(x => x.Months.Select((y,i) => new { i, y = int.Parse(y) })) .GroupBy(x => x.i) .OrderBy(g2 => g2.Key) .Select(g2 => g2.Sum(x => x.y).ToString()).ToList() }).ToList();

Categories : C#

Selected Value not being set in a Dropdown List from a SelectList
Refactore your code the way to not use the ViewBag or the ViewData. It sound silly but it will work and you will have a better code. What you have to do: Create a ViewModel class, it can derive from the Invoice class Add plus properties: pageNumber and the SelectList In the view use the DropDownListFor helper

Categories : C#

The selected value in dropdown list is not displaying
Use <?php if($_GET){ echo 'The course_code selected is'.$_GET['category']; } ?> Or <form name="choose" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> .... <?php if($_POST){ echo 'The course_code selected is'.$_POST['category']; } ?> I'm sure also someone will mention that mysql_ commands are deprecated.

Categories : PHP

How to check box when dropdown list is selected
Server-side (when loading the page) you could use something like: print "option value='{$db->value}' ($db->value==1) ? 'checked' : ''>One</option>"; Client side: you will need to use JavaScript to update the checkbox values

Categories : PHP

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#

Pushing details view controller on list view controller presented in UIPageViewController
@alexbumbu is right the best way is not to over-combine with UIPageViewController and use separate UINavigationControllers for every page stack flow. That was my choice

Categories : IOS

How to pass values from View to a Controller Action parameter? MVC3
This method expects route parameters in a slightly different form: Html.RenderAction("Checks", new {getRoleNames = Model.GetRoleNames}); Update. As to why parameters should be provided in such a form one might refer to the description from MSDN: routeValues An object that contains the parameters for a route. You can use routeValues to provide the parameters that are bound to the action method parameters. The routeValues parameter is merged with the original route values and overrides them. The only thing to be added here is how exactly this object is bound to the input parameters. Default model binder parses input object and tries to find correspondence between object's fields and names of Action's input parameters. So in the case above Action had a single parameter nam

Categories : C#

array of string values not getting populated in the option list in ruby
In Ruby instead of for i in 0...ary.size do ary[i] end you can use Array#each: ary.each do |item| item end This is how I would do it in ERB (more or less): <% %w(Submitted Replied Answered Assigned Started Closed Canceled).each do |status| %> <option value="<%= status %>"><%= status %></option> <% end %> Output: <option value="Submitted">Submitted</option> <option value="Replied">Replied</option> <option value="Answered">Answered</option> <option value="Assigned">Assigned</option> <option value="Started">Started</option> <option value="Closed">Closed</option> <option value="Canceled">Canceled</option> Explanation: %w(Submitted Replied Answered Assigned

Categories : Ruby

How can I get the selected value of a dropdown list created via echo?
You won't have the value from the select box until a subsequent request POSTs it back to you. You need conditional logic that says Is the user getting the page for the first time? Render the select Is the user submitting the page back to me, with the form filled out? Access $_POST

Categories : PHP

JSF: auto conversion when backing a view item with an instance of a subclass of a generic class with resolved type parameter
I've done something similar a couple months ago addressing a different problem. I have an abstract class for many of my JPA entity classes. Every entity converter of that type had almost the same logic and I wanted to use a single converter for that. After a little research I was able to find a solution for an abstract converter for my entities where I could place the common logic. The only problem is that now I need to reference-it by its name (converter="entity"). This solution was found somewhere else (I can't remember where) so I can't take any credits here. The abstract converter: import java.util.HashMap; import java.util.Map; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; public abstract class AbstractCo

Categories : Java

List item inside dropdown box
See if this is what you want: http://jsfiddle.net/M8zAq/ HTML: <ul> <li>English (US)</li> <li class="active">Malay</li> </ul> CSS: ul{ position:relative; } li{ list-style:none; background-color:#EEE; display:none; width:150px; padding:5px; cursor:pointer; position:relative; height:25px; bottom:-35px; } li.active{ display:block; position:absolute; top:0px; } JS: $('li.active').hover( function(){ $(this).siblings('li').show(); }, function(){ $(this).siblings('li').hide(); });

Categories : PHP

How to select item from dropdown list?
Check in your Page_Load that you are only binding when the page is not a postback (i.e. first time it loads), like this: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Only bind here } }

Categories : Asp Net

How to auto-submit Rails formhelper, when onchange occurs on select dropdown (populated from DB)
See documentation: http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-select The arguments goes like this: select(object, method, choices, options = {}, html_options = {}) :onchange belongs to html options thus you need to fix your select box to this: select('post', 'state', @suppliers.collect {|s| [s.supp_state, s.id]}, :onchange => "this.form.submit()")

Categories : Ruby On Rails



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