I have a Gridview which has 10 columns, one of which is a dropdown. I want to take the selected value from it and save it in a specific column of a database. I want to know how and where to access this dropdownlist. If there is a code it will be useful.
Related
I have 10 rows in my access database in which each row contains info about individual person in columns like personid,personname,phoneno,city,street,pincode.
Here when I load these contents in datagridview all the 10 rows are getting displayed.
But my problem is i want to display only a particular person's details in datagridview when he enters his name or id when he logs in.
Any help will be appreciated.
my DataGridview column cell having a combobox that can not shown particular database record, i am trying to solve in c#
first i bind datagridview and then bind combobox through coding.
and fetch data in combobox column from another table.
and save data in database through datagridview
and that datagridview also show the record of data from database but not shown in combobox.
please give me some logic idea what can i do
Y've already helped me a lot. But I have another trouble.
I have an XtraGrid with data. Two columns configured to show checked list box for filtering. For example one column for States and other for Cities. This listboxes contains column data, so user can check multiple values and grid will ilter up its view.
But when you choose filter in first column (for example one State) and then open second column filter its listbox contains all data (with all available Cities, but not the Cities from filtered State) from grid but not from currently filtered view.
Is there any method to update filter checkedlistbox to show only currenlty visible values for column?
You can achieve such functionality by setting ShowAllTableValuesInCheckedFilterPopup to false.
More on the subject here: https://documentation.devexpress.com/#windowsforms/DevExpressXtraGridViewsBaseColumnViewOptionsFilter_ShowAllTableValuesInCheckedFilterPopuptopic
I think it would be easier for you to understand my problem if I explain the scenario a bit.
What I am doing is developing a system to a doctor using asp.net c#. For the creation of the prescription, I add a check box list for the list of medicines and submit button below it. When the submit button clicked selected check box list items added to the sql server database and show a data grid with the selected medicines in the same page.
In the data grid there are two columns for medicine name and dosage.Medicine name is taken from the database.I need to give the user the ability to enter the dosage through that grid view. I need to use update command because the record is already there in the sql server.But empty value in the dosage column.I tried to use update command in the data source control. But I can't figure out how to give the WHERE clause because I can't specify the database row which the updating record relate to.
I would be glad to hear some help from you. All the comments are welcome.
You need to set a parameter(s), please check this example to understand how it works. I guess, that you've added in the database some column that is unique identifier.. some autoincrement int or guid.
I had a column in my DataGridView which is a DataGridViewComboboxColumn, and I need to bind this column from a database table which is also has a column with values like 1,2,3. Based on these values the combo box must display different values, ie. if 1 "Manager" and so on.
Let's use Northwind database as our test data.
These are the steps:
Configure datasource.
Drag a DataGridView to the form.
Drag Products onto the DatagridView.
Right click on DatagridView - Edit Columns.
Select CategoryID, change column type to DataGridViewComboBoxColumn.
Choose the datasource(Category table), display member(CategoryName) and value member(CategoryID) for the column. Click OK to apply changes.
Build and run the project. Voila~