w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
display the retrieved content after choose the option from drop down list in different places using ajax
The value that is given by the select is what is in the value="" attribute on each option. In your case you need to change the code displaying the options to: <select name="users" onchange="showUser(this.value)"> <option value="" selected></option> <?php $sql=mysql_query("SELECT asu_name from asu_staff"); while($row = mysql_fetch_array($sql)){ echo "<option value="".$row["asu_name"]."">" .$row["asu_name"]. "</option>"; } ?> </select> Try this. p.s. you could select an id with the name in your query, then use the id in the value="" attribute. Your query in your php code could then use the id in stead of the name.

Categories : PHP

How to display a list of database records (retrieved via Hibernate) to a JSP page in Struts 2?
May be you understand, but don't know why you didn't any attempt to resolve it. If you want to display data, first you should put it in the database. Check the data is available, connecting to it via the client application. There's many ways to connect to the database, including a JDBC client application supplied with the IDE. It also takes a connection properties right from your hibernate.cfg.xml and has capability to test the connection. Also, make sure the credential used to connect to the database has DML/DDL access privileges to the schema which should be probably created manually. This file is for hibernate configuration, that you should take attention on it, to be valid due to a correct DTD corresponding to the version of hibernate. Then, you are using annotation based mapping, a

Categories : Java

how to display database value in textfield when user select value from drop down list
This should do it. Just make sure $row['price'] is the correct database field key <form action="insertout.php" method="post"> <center> <table> <tr> <td width="116">Medicine name</td> <td width="221"> <center> : <select name="name" id="name"> <option>--- Choose Medicine ---</option> <?php mysql_connect("localhost", "root", ""); mysql_select_db("arie"); $sql = mysql_query("SELECT * FROM tabelmedicine ORDER BY name ASC "); if(mysql_num_rows($sql) != 0){ while($row = mysql_fetch_assoc($sql)){ echo '<option value="'.$row['

Categories : Javascript

I need a drop down list to display a list of active cases, but I keep getting an error when there is more than one returned
You should try add the following in your query: masterCaseList.DataSource = MasterCasesBLL.GetAllMasterCases(false) .Where(x => x.MainContact != null && x.MainContact.MainContact == true) .Select(x => new { MainContact = x.MainContact.MainContactLabel, index = x.ID }) .ToList(); It appears that you have a null reference when the ToList method force the iteration.

Categories : C#

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

Reversing default order of a drop down list
You can reverse the order of the data source before you bind it. if (_group.Category == GroupCategory.Workers || _group.Category == GroupCategory.Acct) { this.cboList.DataSource = null; this.cboList.DisplayMember = "DescForMCE"; this.cboList.ValueMember = "ID"; this.cboList.DataSource = _ch.Accounts.Reverse(); this.cboList.Visible = true; this.lblList.Visible = true; } Depending on the exact type and .NET version of your data source collection, it might not be quite as simple as the above example, which assumes that the data source implements IEnumerable<T> and can directly use the Reverse() extension method[MSDN]. If you only have an IEnumerable (the non-generic version) for instance, you can still accomplish in two calls using Cast<T&

Categories : C#

How can I allow NULL values in a drop down list using Ruby on Rails?
Have you tried <%= f.select :hot_drink, [['Nothing Selected', nil], ['Tea', 'tea'], ['Coffee', 'coffee']] %> Try to add a default value to nil in your migration to handle this case.

Categories : Ruby On Rails

How to display a page with a sorted drop down list?
write a method and call on document ready() function sortMycombo() { $("#select_zone").html($('#select_zone option').sort(function(x, y) { return $(x).text() < $(y).text() ? -1 : 1; })) $("#select_zone").get(0).selectedIndex = 0; e.preventDefault(); });

Categories : Jquery

CSS to display only part of the
Use a :before pseudoelement to show the prefix, e.g. http://jsbin.com/erazar/1/edit CSS option:before { content: "(" attr(value) ")"; display: inline-block; margin-right: .5em; } HTML <select> <option value="+93">Afghanistan</option> <option value="+355">Albania</option> <option value="+213">Algeria</option> <option value="+1">American Samoa</option> </select> With this approach the prefix will appear in front of the option and your user will be able to choose the State typing its name by the keyboard

Categories : HTML

AngularJS: How to display a list of images (via Drag and Drop)
Assuming that fileList variable contains the files that have been dragged and dropped, that is, taking the following line as reference: // FileList should go to the controller/view var fileList = evt.dataTransfer.files; ...you simply change the fileList variable to a scope variable instead of a local variable. Thus the above code would then read $scope.fileList = evt.dataTransfer.files; You don't need the $scope.$apply() function that follows the above code. Instead, your files should already be present in $scope.fileList. Use can then use this variable in the view that holds the drop-target directive.

Categories : Angularjs

How to store value from Drop Down List In Database
Change: $select_query= 'Select * from category'; $select_query_run = mysql_query($select_query); echo " <form action='insert_product.php' method='POST' ></br> Product Name: <input type='text' name='product_name' /></br> Price : <input type= 'text' name= 'price' /></br> Description : <input type='text' name='description' />*Seperate by Comma</br> <input type='submit' value='Insert' />"; echo "<select name='category'>"; while ($select_query_array= mysql_fetch_array($select_query_run) ) { echo "<option value='".$select_query_array['category_id']."' >". htmlspecialchars($select_query_array["name"])."</option>

Categories : PHP

Mysql Database & drop-down List
if you mean foreign keys, you can do as below : Convert both tables into innodb, if they are not already. View the structure of the table which will have a foreign key. Make the referencing field an INDEX. Now come back to structure view and click Relation view. you can see more details in Here

Categories : PHP

PHP Drop Down List Populated By Oracle Database Rows
You're not executing the query, after parsing the query you need to execute it before fetching the results, the function you need is oci_execute(), used like this: $success = oci_execute($stid)

Categories : PHP

Why can't I see my data from my drop down list saved in my database on myphp?
You have the closing tags for </datalist> and </select> the wrong way round is one possibility although it still appears to work that way on FF. Mainly there was a bit of a mess here: <Option Value="Router" Input value= "Router">Router</option>. If that is tidied up it should works. <select list="Categorie" name="aa" id="aa"> <datalist id="Categorie"> <Option Value="Router">Router</option> <Option Value="Switch">Switch</option> <Option Value="Toestel">Toestel</option> <Option Value="Basisstation">Basisstation</option> <Option Value="Repeaters">Repeaters</option> </datalist> </select>

Categories : Javascript

How to retain the value of database driven Drop Down List Box when you click Edit?
Get the submitted value from $_GET/POST While looping over the possible values, test to see if there is a match Add a selected attribute if there is

Categories : PHP

populate drop down list from database using mysqli prepared statements
You should use double quotes for variable expanding, or exit the string and concat normally. Also, change to while($stmt->fetch()){?> echo '<option value="'.$author.'">"'.$author.'"</option>'; Try also using this query instead: "SELECT author, book_name, language FROM bk_tst_fltr GROUP BY author"

Categories : PHP

How to Create a Dynamic Drop Down List in PHP populated from MySQL Database
$select_query= "Select name from category"; $select_query_run = mysql_query($select_query); $selectTag = "<select>"; while ($select_query_array= mysql_fetch_array($select_query_run) ){ foreach ($select_query_array as $select_query_display){ $selectTag .="<option value='' >$select_query_display</option>"; } } $selectTag .= "</select>"; echo $selectTag;

Categories : PHP

PHP code to retreive from database to HTML drop down list not working.
The value attribute is for specifying the value which is sent with the form, usually an id. You have to add the country names between the tags to display them. echo '<option value="'.$row['country'].'">'.$row['country'].'</option>'; But when the two are the same you don't need to specify value: echo '<option>'.$row['country'].'</option>';

Categories : PHP

How to save values from Dynamic Drop Down List into MySQL database
while ($select_query_array= mysql_fetch_array($select_query_run) ) { echo "<option value= '$select_query_array['category_id']' >".htmlspecialchars($select_query_array["name"])."</option>"; $selectTag= "</select>"; echo $selectTag; should be while ($select_query_array= mysql_fetch_array($select_query_run) ) { echo "<option value= '{$select_query_array['category_id']}' >".htmlspecialchars($select_query_array["name"])."</option>"; } $selectTag= "</select>"; echo $selectTag; You are missing closing brace for the while loop. You are also missing braces around the variable to replace.

Categories : PHP

The partial view to display a list I think I said that the parameters are null when it is not
In the view where I call the partial the sintax of call is: @Html.Action("Metodo") where Metodo is a method in my control class My error was that y write: @Html.Partial("source.ext")

Categories : Asp Net Mvc

Preventing Django admin panel to show drop-down list in Inline display of ManyToMany relationships
This should work. class RelationshipFormSet(BaseInlineFormSet): def get_queryset(self): if not hasattr(self, '_queryset'): criteria = {} #Your criteria here qs = super(RelationshipFormSet, self).get_queryset().filter(**criteria) self._queryset = qs return self._queryset class RelationshipInline(admin.TabularInline): model = Relationship extra = 0 fk_name = 'parent_message' formset = RelationshipFormSet

Categories : Django

How to make a jQuery UI droppable list where elements added to the list are also drop targets
I think what you really want is a sortable for the users list and then all the draggable for the "eligible items" jQuery(function($) { $('#list2 li').draggable({ cursor: 'move', helper: 'clone', connectToSortable: "#list1", }); $('#list1').sortable({ revert: true, }); }); http://jsfiddle.net/petersendidit/gKtXa/5/

Categories : Javascript

A combo-box providing a resizable file name completion list and drop-down list with a history
Solution for WPF Part 1 Principle, you can use styles and templates for the implementation of your question. In the ComboBox the result is given in the Popup, but default it does not support changing the size. Add resizing is not difficult, if you use event DragDelta. Example: private void MyThumb_DragDelta(object sender, DragDeltaEventArgs e) { double yadjust = MyPopup.Height + e.VerticalChange; double xadjust = MyPopup.Width + e.HorizontalChange; if ((xadjust >= 0) && (yadjust >= 0)) { MyPopup.Width = xadjust; MyPopup.Height = yadjust; } } The event is better to set on the Thumb control (He also has events DragStarted, DragCompleted). It's all very well, but we do need to do inside the ComboBox. One way is to use the S

Categories : Wpf

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

enum values in drop down list using ViewData and th viewcode to list it?
This will return Enum.GetNames(typeOf(Language )) English spanish Arabi And this Enum.GetValues(typeOf(Language )) 1,2,3 You can languages list to view: ViewBeg.Languages = Enum.GetNames(typeOf(Language)).ToList();

Categories : C#

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

Populate Telerik Drop-down list based on what is selected in other list
You can do it like this: View: <p> <%: Html.Label("Type") %> <%: Html.Telerik().DropDownList().Name("Type") .HtmlAttributes(new { id = "type" }) .Items(items => { items.Add().Text("").Value(""); items.Add().Text("Numbers").Value("1"); items.Add().Text("Alphabets").Value("2"); }) .CascadeTo("Values") %> </p> <p> <%: Html.Label("Values" %> <%: Html.Telerik().DropDownList().Name("Values") .HtmlAttributes(new { id = "values" }) .DataBinding(b => b.Ajax().Select("GetDropDownValues", "Home")) %> </p> Controller: public class HomeController : Controller { public ActionResult Index() { return View(); } [HttpPost] public JsonResult GetDropDo

Categories : C#

Create Drop down list as value list dynamically in Access 2010
What you're trying is pretty logical but you need to use the combobox's AddItem method. Private Sub Form_Load() Me.FNMARemittanceType.RowSourceType = "Value List" If Not Me.InvestorName = "Freddie Mac" Then Form_frmPatronInvestorGroupDetails.FNMARemittanceType.AddItem("Actual/Actual") Form_frmPatronInvestorGroupDetails.FNMARemittanceType.AddItem("Scheduled/Scheduled") Else Form_frmPatronInvestorGroupDetails.FNMARemittanceType.AddItem("Gold") Form_frmPatronInvestorGroupDetails.FNMARemittanceType.AddItem("First Tuesday") End If End Sub

Categories : Vba

Kendo UI Web - Drop-down list, different background color on each list item.
There is one easy part and one difficult part. The easy is getting the background the difficult is making it look nice. Easy, define a template for rendering each list item: <script id="template" type="text/kendo-tmpl"> <div style="background-color: #= text #;">#= text #</div> </script> And then define your ComboBox as: $(document).ready(function () { $('#combobox').kendoComboBox({ template : $("#template").html() }); }); but this is likely to do not be as nice as you want since before the <div> from my template there is a <li> introduced by KendoUI and unless you want to start playing with it, you might consider just displaying a color square with the item color. You can do something like: Start defining a CSS for the color

Categories : CSS

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

Hot to Create multiple list data in one drop down list
[AcceptVerbs(Http.Get)] public ActionResult GetValueExample() { ViewData["MyItems"] = GetSelectList(); return View(); } [AcceptVerbs(Http.Get)] public ActionResult GetValueExample(string MyList) { //MyList contains the selected value SelectList list = GetSelectList(); //list will contain the original list of items //... } private SelectList GetSelectList() { Dictionary<string, string> list = new Dictionary<string, string>(); list.Add("Item 1", "1"); list.Add("Item 2", "2"); list.Add("Item 3", "3"); return new SelectList(list, "value", "key"); } //... <%= Html.DropDownList("MyList", ViewData["MyItems"] as SelectList) %>

Categories : Asp Net Mvc

How to list fields that are missing a trait and eliminate the ones that are not
The easiest way to rewrite it is to use LEFT JOIN to find any matches on ProductCategoryKey, and IS NULL to remove the rows that include a match, something like; SELECT DISTINCT r.ResellerName FROM DimReseller AS r LEFT JOIN FactResellerSales AS rs ON r.ResellerKey = rs.ResellerKey) LEFT JOIN DimProduct AS p ON rs.ProductKey = p.ProductKey) LEFT JOIN DimProductSubcategory AS psc ON p.ProductSubcategoryKey = psc.ProductSubcategoryKey) LEFT JOIN DimProductCategory AS pc ON psc.ProductCategoryKey = pc.ProductCategoryKey AND pc.ProductCategoryKey IN (1,2,3,4,5,6,7,8) WHERE pc.ProductCategoryKey IS NULL ORDER BY r.ResellerName

Categories : SQL

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

How to display checked value in Jquery Dropdown List populate from database
you can refer to this question: jQuery - setting the selected value of a select control via its text description But if you use php to build the option html, why not set the selected option with php. Something like this in your loop (just an example!) <?php $sel = ''; if($rowsakh['diet_id'] == $_POST['someVarName']) { $sel = 'selected'; } echo ' <option value="' . $rowsakh['diet_id'] . '|' . $bnum . '"' . $sel . '>Audi</option>'; ?> I personnaly wouldn't use echo statements in the while loop. I would concatenate it as a long string and finally echo once at the end.

Categories : PHP

How to add retrieved records from a table in a List/IEnumerable
This is getting a bit confusing... So, basically you have a parent child relationship in your tables. I have a very similar tutorial which will hopefully solve your problem. Thats how the data is read ArrayList rowList = new ArrayList(); SqlDataReader reader = storedProcCommand.ExecuteReader(); while (reader.Read()) { object[] values = new object[reader.FieldCount]; reader.GetValues(values); rowList.Add(values); } and this is how the values are added to the ListView orderDetailsList.Items.Clear(); foreach (object[] row in rowList) { string[] orderDetails = new string[row.Length]; int columnIndex = 0; foreach (object column in row) { orderDetails[columnIndex++] = Convert.ToString(column); } ListViewItem newItem = new ListViewItem (orderDetails);

Categories : C#

Convert list to dataframe in R when dataframes in list are named NULL
You can use rep on the rows of each data.frame in your list to get the L1 column. Then it's straightforward to cast: # ll is your list of data.frames ll.df <- cbind(L1 = rep(seq_along(ll), sapply(ll, nrow)), do.call(rbind, ll)) require(reshape2) dcast(ll.df, L1 ~ description) L1 age location name tenure 1 1 25 florida mike <NA> 2 2 <NA> new york jim 5

Categories : R

How to display mysql database entries in unordered list, 3 to a row in descending order using PHP
Here is an example in PDO First, connecting to the database: $server = 'localhost'; $database = 'db_name'; $db_username = 'username'; $db_password = 'password'; $dsn = "mysql:host=$server;dbname=$database"; try { $db = new PDO($dsn, $db_username, $db_password); } catch (PDOException $e) { //You can do what you like with any error messages (echo, store, etc) $error_message = $e->getMessage(); } Next, creating the function that will have the query in it: Query Functions go in the Model (MVC) //Use a function that can accept parameters (users id, search term, etc) //For your question, there are no parameters function getPosts() { global $db; global $database; $sql = "SELECT * FROM $database.tbp_blog ORDER BY timestamp DESC LIMIT 5"; //If your query was mor

Categories : PHP

How to retrieve an images from PHp myadim database and display in android list view?
Will that work, I have edited this after your comment <?php /* Our "config.inc.php" file connects to database every time we include or require it within a php script. Since we want this script to add a new user to our db, we will be talking with our database, and therefore, let's require the connection to happen: */ require("config.php"); //initial query $query = "Select * FROM channels"; //execute query try { $stmt = $db->prepare($query); $result = $stmt->execute($query_params); } catch (PDOException $ex) { $response["success"] = 0; $response["message"] = "Database Error!"; die(json_encode($response)); } // Finally, we can retrieve all of the found rows into an array using fetchAll $rows = $stmt->fetchAll(); if ($rows) { $response["succes

Categories : PHP

A list of, list of ObservableCollection comes up null when looping through it
There is nothing particularly wrong with what you've posted. You do not encounter null, that was the wrong diagnosis. You've got a collection of collections, it contains one item. Which is a collection that's empty. I don't doubt that's a bug, but it is not a bug in the code you've posted. Best to focus on the code that is supposed to add Image objects to that empty collection.

Categories : C#

How to ignore a list mapping when the list is empty but not null?
I wrote this extension, hope it helps! public static void MapListIfNotEmpty<TSource, TMapFrom>(this IMemberConfigurationExpression<TSource> map, Func<TSource, IEnumerable<TMapFrom>> mapFrom) { map.Condition(src => !mapFrom(src).IsNullOrEmpty()); map.MapFrom(mapFrom); } and you can use it like this: Mapper.CreateMap<Model.Event, DataContracts.Event>() .ForMember(des => des.Divisions, e => e.MapListIfNotEmpty(source => source.Geographies));

Categories : C#



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