Scenarios:
Based on selection of a dropdown value and click of search button gridview to be binded. This datatable will have different table/column records based on selected value of a dropdown.
For ex :
If dropdown list value "Yes" is selected Column 1 to Column 6 to be bounded from table A where column 1 is a check box , column 2 is a bound field and column 3,5,6 is a textbox and column 4 is a dropdown
If dropdown list value "No" is selected Column 1,Column 4 to Column 8 to be bounded from table A where column 1 is a check box , column 4 is a bound field and column 6,7,8 is a textbox and column 5 is a dropdown
I have to edit each records on by one and save it to a data table. on click of a final submit button the records to be saved in database
Related
I want to populate the other column when I select the ComboBox in a DataGridView
This is a pic to make it easier to explain
I manage to select all the "Name" in my database and put it to the 1st column
If I select a data in my DGVComboBox the other column should fill according to my db data.
example
If I pick "Cement" in the first DGVcombobox the second column should be filled with "21".
I have DataGridView, in which, I would like to have two columns.
1st column to show object name
2nd column to show object value in combobox
In first row, I want to display information about "Birds" i.e. first column will have text as "Birds" and second column will contain a combobox having the names of birds.
In second row, I want to display information about "Animals" i.e. first column will have text as
"Animals" and second column will contain a combobox having the names of animals.
Please let me know how can I achieve this in C#.
Thanks.
you can add column in data grid viewer and set its type Combo box.
So in this photo I have a gridview,
Column 1 is DropDownList, Column 2 is TextBox and Column 3 is Read Only. for Column 1 as a TextBox, when I clicked Edit, changed the value of TextBox and then I clicked Update, the Value of Column 1 chenged. Then I replaced TextBox from column 1 to a DropDownList. I converted Column1 into a TemplateField, Edited template field of column 1 and changed it as a DropDownList. Now When I try to Edit a Row, I choose another value from DropDownList and it doesn't change.
NOTE: I haven't don this programmatically. .aspx.cs file is empty. I have done this via GridView Tasks.
UPDATE:
I have managed to fix the problem.
On EditTemplateField, on DropDownList I clicked Edit Data Bindings
After that on Selected Value I bounded it to the column I want.
I am using windows forms application. I have two combo boxes , comboA and comboB.I have a datagrid view with two columns. Now I have to populate the datagrid view, with selected item from comboA into first column of datagridview and selected item of comboB into the second column. Please suggest me
To be clear, When I select an item from comboA, it should be displayed in first column of datagridview. And similary when i select an item from comboB , it should be displayed in the second column of the datagridview.
I created a user control which sets Name while entering code in textbox. Then I created a datagridview column of type usercontrol it is working but when focus is lost no value is displaying in column and another problem is same value is there for all columns.
It is america in column when I move to next row or column then it becomes blank:
I want the selected text in that column