This is a migrated thread and some comments may be shown as answers.

GridViewComboBoxColumn.CellElement

3 Answers 105 Views
GridView
This is a migrated thread and some comments may be shown as answers.
HamiD Mayeli
Top achievements
Rank 1
HamiD Mayeli asked on 29 Oct 2009, 07:27 AM
Hi,

I Have a RadTabStrip On Form and two TabItem on TabStrip and a Grid On each TabItem in this Grids, i have GridViewComboColumn. when a tabItem active i cant access to GridViewComboColumn.CellElement.Text of another TabItem`s Grid,
if i wanna to get displayMember value (GridViewComboColumn.CellElement.Text) what i must do.

Best Regard.

3 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 04 Nov 2009, 07:52 AM
Hello HamiD Mayeli,

Thank you for writing.

Because RadGridView uses virtualization to show its cells, it is not possible to get the ValueMember for a specified cell in combo box column. However, you can get the actual cell value and find the respective display value in the combo column data source. You can get the cell value using its Value property:

object value = this.radGridView1.Rows[1].Cells[1].Value;

Do not hesitate to contact me again if you have any other question.

Best wishes,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
HamiD Mayeli
Top achievements
Rank 1
answered on 04 Nov 2009, 06:03 PM
Hi Martin,

Tanx For your Help, But i dont need to Cell.Value cuz then i have to get displaymember from DataBase,
so you said i cant get it.

Tanx alot.
0
Martin Vasilev
Telerik team
answered on 06 Nov 2009, 05:39 PM
Hello HamiD Mayeli,

Thank you for getting back to me.

You cannot get it directly, but you can find the respective display member in the ComboBox column's DataSource for a given value. Please, consider the following code as example how to get display member for a typed DataSet:
 
object value = this.radGridView1.CurrentRow.Cells["CompanyName"].Value;
MyProject.NwindDataSet.CustomersRow row =
    this.nwindDataSet.Customers.FindByCustomerID(value.ToString());
MessageBox.Show(String.Format("DisplayMember={0}", row[1]));

More information how to locate specific row in DataTable you can find in MSDN library. Write me back if you have any other questions.
 

Greetings,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
HamiD Mayeli
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
HamiD Mayeli
Top achievements
Rank 1
Share this question
or