How can we retrieve the value which was selected from a combo box in a datagrid view.

The grid view consists of 3 columns which are combo Boxes. I want the string in the 1st column.

Editorial / Best Answer

veluworld  

  • Member Since Jul-2007 | Aug 28th, 2008


((DropDownList)GV_chart.Rows[e.RowIndex].FindControl("Dcity1"));

Here GV_Chart is the id of Grid View And DCity is the Name of the dropdown list

Showing Answers 1 - 9 of 9 Answers

devendra

  • Sep 6th, 2007
 

You have to first fill combo box by particular field then on selectiveindexchanged event of combobox fill the gridview by query("select * from tablename where field =' " & combobox1.text & '' ' ")

  Was this answer useful?  Yes

amitrms

  • Jul 14th, 2008
 

Use this for fetching the values from combo box

for (int i = 0; i < dataGridView1.Rows.Count; i++)                    {                     if (dataGridView1.Rows[i].Cells[2].Value.ToString() != "Please Select")                        {                           // Write code here;
                         }                                            }

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions