GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  ADO.NET 2.0
Go To First  |  Previous Question  |  Next Question 
 ADO.NET 2.0  |  Question 15 of 19    Print  
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.


  
Total Answers and Comments: 3 Last Update: August 28, 2008     Asked by: Bharath 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: veluworld
 
((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

Above answer was rated as good by the following members:
KrShekhar, adib4u2000, Ag2703
September 06, 2007 04:57:55   #1  
devendra        

RE: How can we retrieve the value which was selected f...
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 & '' ' )
 
Is this answer useful? Yes | No
July 14, 2008 10:25:47   #2  
amitrms Member Since: July 2008   Contribution: 1    

RE: How can we retrieve the value which was selected from a combo box in a datagrid view.
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;
} }


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 28, 2008 02:45:58   #3  
veluworld Member Since: July 2007   Contribution: 5    

RE: How can we retrieve the value which was selected from a combo box in a datagrid view.
((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

 
Is this answer useful? Yes | NoAnswer is useful 3   Answer is not useful 0Overall Rating: +3    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape