w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
ASP gridview not updating database
Add: <asp:Parameter Name="eID" Type="Int32" /> To: <UpdateParameters> <asp:Parameter Name="eFirstName" Type="String" /> <asp:Parameter Name="eLastName" Type="String" /> <asp:Parameter Name="eJobTitle" Type="String" /> <asp:Parameter Name="deptNumber" Type="String" /> <asp:Parameter Name="eUserName" Type="String" /> <asp:Parameter Name="ePassword" Type="String" /> <asp:Parameter Name="eEmail" Type="String" /> <asp:Parameter Name="ePhone" Type="String" /> <asp:Parameter Name="eDateHire" Type="DateTime" /> <asp:Parameter Name="eDateTerm" Type="DateTime" /> <asp:Parameter Name="securityID" Type="Int32" /> </UpdatePa

Categories : Asp Net

Updating records, getting successful message but data isn't being updated in database
You query is still failing, you are seeing "Updated data successfully" because it is outside of the if statement. Try this: if(!$retval){ //query has failed, produce error die('Could not update data: ' . mysql_error()); } else{ //query is successful echo "Updated data successfully "; mysql_close(); }

Categories : PHP

Dropdown list in Gridview
You have to define all your values in this gridview. <asp:GridView ID="gviewPermissionHistory" runat="server" Width="85%" onrowdatabound="gviewPermissionHistory_RowDataBound"> <Columns> <asp:BoundField DataField="Field1" /> <asp:BoundField DataField="Field2" /> <asp:TemplateField HeaderText="State"> <ItemTemplate> <asp:DropDownList ID="ddlStatus" runat="server" > <asp:ListItem Text="Approved" Value="0"></asp:ListItem> <asp:ListItem Text="Declined" Value="1"></asp:ListItem> </asp:DropDownList> </ItemTemplate>

Categories : Asp Net

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

How to bind gridview at pageload with dropdown list
You should implement the RowCommand event from the GridView. You alredy have the CommandField, so do something like this: void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e) { // // Get the keys from the selected row // LinkButton lnkBtn = (LinkButton)e.CommandSource; //the button GridViewRow myRow = (GridViewRow)lnkBtn.Parent.Parent; //the row GridView myGrid = (GridView)sender; // the gridview int reviewid = Convert.ToInt32(GridView1.DataKeys[myRow.RowIndex].Value); //value of the datakey **strong text** // If multiple buttons are used in a GridView control, use the // CommandName property to determine which button was clicked. // In this case you are pressing the button Select, as ou already // defined this at the aspx code. if(e.CommandNam

Categories : C#

MVC4 Cascading dropdown list just working for 2 dropdown lists and not for more than that
I just moved the two onchange functions (other than firstone) to other views, which load my dropdowns. Actually it was a post back issue, so on single view Change for more than one "ddl" was not fired. Moving it to Partial Views did the trick

Categories : Jquery

Updating a knockoutjs dropdown list and the knockout value using jQuery
Your changeCountry method should be changing the value of the underlying observable that you have bound the select to: function changeCountry(isoId) { selectedCountry(isoId); } That should then update both, as far as I'm aware. You will also need to pass the new id in as a string, as knockout may well be using the type equality comparer (===), and the value in the html will be a string.

Categories : Knockout Js

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

ASP.NET MVC dropdown-list from database
Add the SelectList to your model: public SelectList DropDownList { get; set; } build the class for that collection: public class MyListTable { public string Key { get; set; } public string Display { get; set; } } and then in your controller, load the data for the MyListTable class from the database: var list = new List<MyListTable>(); using (SqlConnection c = new SqlConnection(cString)) using (SqlCommand cmd = new SqlCommand("SELECT KeyField, DisplayField FROM Table", c)) { using (SqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { list.Add(new MyListTable { Key = rdr.GetString(0), Display = rdr.GetString(1) }); } } } var model = new users(); model.Drop

Categories : C#

Dependent dropdown list working in php and not working in codeigniter
try this one put this one var base_url="<?=base_url()?>" somewhere inside the script tag may be before $(document).ready(function(){ line and change the line url: "upload1_site/upload", with url: base_url+"upload1_site/upload", please let me know if it works or not.

Categories : PHP

How to select an option from a dropdown list in one webform and view the result in a gridview in another webform?
You can just store the selected item text in onw variable, like the below: dim selText as string = DropDownList1.SelectedItem.Text and on the click of submit button, perform your required tasks and then redirect page to another page along with the department name. Like the below code: Response.Redirect("Page2.aspx?department=" + selText) and on the second page i.e. Page2.aspx, just receive this value in query string, using below code.. wherever it is necessary either on page load or at your required place. If Request.QueryString("department") <> Nothing Then dim departmt as string = Request.QueryString("department") End If And use the above variable's value in your database query and get the related data to the department selected in the previous form. I hope it will h

Categories : Asp Net

Generating a dropdown list with database first
You did not provide any code of what you have done so far so I know nothing about the data that you have been working with. I will post some code and all that you will have to do is to modify it to fit in with your scenario. Lets work with a simple solution of loan applications. A client needs to apply for a loan and he needs to supply banking details. He will have to select a bank from a drop down list. Lets start with the domain model called Bank. This represents your data coming from your database table. Lets call the table Banks. public class Bank { public int Id { get; set; } public string Name { get; set; } } Your table called Banks will look like this: Id | int | not null | primary key Name | varchar(50) | not null Depeneding on you what you need to do I normally

Categories : Asp Net

SQL Database Updating not working
protected void cmdInsert_Click(object sender, EventArgs e) { con.Open(); string InsertQuery="Insert into WhatTypes([First Name], [Last Name], [TP Number], Email, UserName, Password, UserLevel) "+ " Values (@fname,@lname,@tpNumber,@email,@userName,@password,@userLevel)"; cmd = new SqlCommand(InsertQuery,con); cmd.Parameters.AddWithValue("@fname",lblENFN.Text); cmd.Parameters.AddWithValue("@lname",lblENLN.Text); cmd.Parameters.AddWithValue("@tpNumber",lblNTPn.Text); cmd.Parameters.AddWithValue("@email",lblENEm.Text); cmd.Parameters.AddWithValue("@userName",txtEUN.Text); cmd.Parameters.AddWithValue("@password",lblENP.Text); cmd.Parameters.AddWithValue("@userLevel",lblEUL.Text); cmd.ExecuteNonQuery(); con.Close(); } protected void cmdUpda

Categories : C#

Updating a friend list in my database
You can delete all and then repopulate or you can store the initial state of the list of friends, then compare with the final list after user edit. I recommend you use this function array_diff($array1, $array2), doing something like: $initial_list = array (1,2,3,4,5); $list_after_edit = array (1,2,5,6); $all_new_items = array_diff($list_after_edit,$initial_list); foreach ($all_new_items as $item) { // Add to database this item } $all_deleted_items = array_diff($initial_list,$list_after_edit); // Execute this query: $query = 'DELETE FROM table WHERE `User Id` = <some ID> AND `Friend Id` in (' . implode(',',$all_deleted_items) . ')';

Categories : Mysql

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

c# code in asp.net for displaying database values in dropdown list
Dont write the code in dropdowns selected index changed event write it in a function and call it in pageload event you have to set the DataTextField and DatavalueField objc.ClientName = Convert.ToString(Session["ClientName"]); DataSet ClientN = obj.GetClientList(); DataView Projview = new DataView(); Projview.Table = ClientN.Tables[0]; DrpClientName.DataSource = Projview; DrpClientName.DataTextField="Description"; DrpClientName.DataValueField="ID"; DrpClientName.DataBind();

Categories : C#

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

dependent dropdown list is not working
That is because you are loading your subject along with the course, if you want to load your subject AFTER choosing course, what you can do is put your subject into a div(or tbody) tag like this <div class="subject"></div> and in your jquery: $("#course_code_id").live("change keypress",function(){ var id = 0; id = $(this).val(); if( $(this).val() !==''){ $.post('<?php echo site_url('subject/search_by_course') ?>', { subject_id: id },function(data){ $(".subject").html( data['html_string']); },"JSON" ); } }); in your controller function search_by_course() { $this->load->model('subject_model'); $id = $this->input->post('subject_id'); /

Categories : PHP

Updated views in list item don't stay updated when scrolling through listview[IMG + SOURCE]
In the question's comments, it was established that even though the UI was being updated (based on user interaction), the underlying data used by adapter's getView() weren't. Solution: Update the data source and call notifyDataSetChanged() on the adapter. Let getView() handle UI updates. Read through the comments for more information.

Categories : Android

Yii Framewok Foreign Key Store In The Database When Selected From Dropdown List
Do it something like this <?php echo $form->dropdownList($products,'product_name', CHtml::listData(Products::model()->findAll(), 'id', 'product_name'), array('id'=>'productType','name'=>'productType'))); ?> Your hidden variable <?php echo CHtml::hiddenField('productTypeId','',array('class'=>'ProductTypeId')); ?> And the javascript code to select the id $('#listingType').change(function(){ var productid=$('#productType').val() $(".ProductTypeId").val(productid); }); In controller action public function actionCreate(){ $productId=$_POST['productTypeId']; //code to store in sales table }

Categories : PHP

How to populate a dropdown list from the database table in SugarCRM Community 6.5?
I posted directions on how to do this here some time ago: http://www.eggsurplus.com/content/populate-a-dropdown-from-the-database/ What you need to do is to create a custom util function and then tell your vardefs for that field to call the custom util function. //custom/Extension/application/Ext/Utils/getAccounts.php function getAccounts(){ static $accounts = null; if(!$accounts){ global $db; $query = "SELECT id, name FROM accounts"; $result = $db->query($query, false); $accounts = array(); $accounts[''] = ''; while (($row = $db->fetchByAssoc($result)) != null) { $accounts[$row['id']] = $row['name']; } } return $accounts; } Name of the file doesn't matter. Make sure to include opening PHP tags.

Categories : PHP

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 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

Chosen dropdown list not working with Modal
I can't exactly tell what the problem is without seeing your actual code structure, but generally I think it's a good idea to populate you selects before initializing the plugin, so the best approach would be to add the plugin initialization on your elements in your ajax callback after the options have been added. var callbackSuccess = function(data){ if ( data ) { populateDropDownById(data, 'objectiveBanks'); $(".chzn-select").chosen(); $(".chzn-select-deselect").chosen({allow_single_deselect:true}); //Other things } }; If you need to add options to your <select> elements after the plugin is initialized, you'd need to trigger the chosen:updated event on the field, ex: $(.chzn-select").trigger("chosen:updated");

Categories : Twitter

Setup a
It looks like you are using the designer to setup your dropdown list data source. Here is how you could do it in code: protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { MyLinqToSqlDataContext db = new MyLinqToSqlDataContext(); var result = from c in db.Customers select g; customerName.DataSource = result.ToList(); customerName.DataTextField = "Name"; customerName.DataValueField = "ID"; customerName.DataBind(); ... } }

Categories : C#

Gridview is not working in Ajax Update Panel with Drop Down List inside it
There is problem in your page load. Add ispostback checking in Pageload. protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) { Add_Dep(); } }

Categories : Asp Net

javascript/jquery clone not working in dropdown list
try this http://jsfiddle.net/jW6eL/7/ $("#mode").on('change', function () { var rows = parseInt(this.value); console.log(rows); var lastRow; for (var i = 0; i < rows; i++) { lastRow = $('#engagements tr').last().html(); $('#engagements tr:last').after('<tr>'+lastRow+'</tr>'); $('#engagements tr:last').find('select').each(function(){ var this_select=$(this); this_select.val(this_select.closest('tr').prev().find('td:eq('+this_select.closest('td').index()+')').find('select').val()) }) } });

Categories : Javascript

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#

not working dropdown list in edit view in mvc4 razor
You should not use the same value (IDCountry) as first and second argument for the dropdown. The first argument represents the value to bind the dropdown to while the second represents the available values. So: @Html.DropDownList( "SelectedCountryID", (IEnumerable)ViewBag.IDCountry, new { @class = "span6" } ) To avoid all those confusions with Dropdowns I would recommend you using a view model: public class MyViewModel { public string SelectedCountryID { get; set; } public IEnumerable<SelectListItem> Countries { get; set; } } and then your controller action will populate and pass this view model to the view: public class HomeController: Controller { public ActionResult Index() { var model = new MyViewModel(); // preselected an elem

Categories : Asp Net Mvc

GridView is not updated with notifyDataSetChanged()
The first, you should download Image from URL and return it. import java.io.InputStream; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.util.Log; import android.widget.ImageView; public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> { ImageView bmImage; public DownloadImageTask(ImageView bmImage) { this.bmImage = bmImage; } protected Bitmap doInBackground(String... urls) { String urldisplay = urls[0]; Bitmap mIcon11 = null; try { InputStream in = new java.net.URL(urldisplay).openStream(); mIcon11 = BitmapFactory.decodeStream(in); } catch (Exception e) { Log.e("Error", e.getMessage());

Categories : Android

sort updated gridview after databind
You should filter the duplicate row before setting the source of the gridview. This will allow you to sort before the binding the grid as well. This will depend on the source of the dataset ds, how are you getting this data? Rowdatabound should not be used to remove/add rows to the table, that should be done to the the table stores in the dataset ds

Categories : C#

Some columns empty in updated gridview row after update
The issue here is that after the Update, links to other entities are NULL for the updated row. What you can do is use the ID that corresponds to the link to the other entity and do an on-demand look-up. That is, maybe your is defined like <%# Eval("Customer.FirstName") %>, after the update, that row might be empty because the attribute "Customer" that is the link to the customer entity to get the first name, is null. So just define the like so: <%# Eval("Customer.FirstName") ?? Customer.GetFirstNameByID(Eval("CustomerID")) %> You would define the function GetFirstNameByID inside the Customer entity class to return the customer first name. Now after an update, if and when the "Customer" attribute is null, the first Eval() will return null so the second statement will exe

Categories : Asp Net

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

Knockout not updating UI after ViewModel is updated
You assign data to mdl.CancellationAmount in a wrong way. It is already observable so you should use () to assign value in done function. Rewrite your callback as follow: .done(function (response) { mdl.CancellationAmount(response); })

Categories : Knockout Js

Updating a view in backbone when a collection is updated
this.collection.on("add", this.addDisplayView, this); Then create a function addDisplayView that accepts the model for the view. You will need to refactor the this.collection.each(function(item)... part of your code to use the addDisplayView function. GroupListView.prototype.addDisplayView = function(model){ var displayView = new app.GroupListDisplayView({ model: model, collection: this.collection }); // use this.$, as it is already mapped to the context of the view return this.$("#people-groups-list").append(displayView.render()); } You should also change this.collection.push(this.model); to this.collection.add(this.model); addcollection.add(models, [options]) Add a model (or an array of models) to the collection, firing an "add" event. If a m

Categories : Javascript

Core Data not updating, updated model
Things to check: Did you save your core data entities with [managedObjectContext save:&error] at the appropriate places (e.g. before displaying the new table view data)? Did you check the error variable? Did you migrate your model correctly with a new model version? Are you reading the correct attributes and displaying them correctly (in UI or log statements)? BTW, in your code you are setting the request entity twice.

Categories : Objective C

QLabel updated from slot call not updating
Which thread is calling this slot? Remember that if the QObject emitting the signal and the QObject receiving it live in the same thread then the connection will be direct and not scheduled using an event queue. It might be that your event thread is the one processing the loop that contain the emit. In this case your application will never update the GUI since it is locked processing your loop. Are you doing the frames acquisition in a separate thread?

Categories : C++

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

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

Get data from the row of a Dropdown in a Gridview
Check the GridView's DataSource before you do the DataBind(). Since you're missing the full ASPX markup, I'm not sure if you're setting the data source programmatically or with a SqlDataSource. In any case, what will happen often with programmatically-set Data Sources is that they disappear on a PostBack, and when you call that DataBind, you're really DataBinding it to null, which would explain why you're getting string.Empty ("") for the Label's Text property.

Categories : Asp Net



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