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

Retrieve value of a combobox column

2 Answers 168 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Deborah
Top achievements
Rank 1
Deborah asked on 16 Oct 2010, 06:52 PM
I am writing my own resize code based on discussions in some other threads. I am using the code from one of the examples that looks through each row and gets the column value and then uses MeasureString to determine the correct string width.

This is working well for all but my combobox columns. The value of those columns is the Id (like 35) instead of the display value (like "Acme Inc"). So the size of the column is not being set appropriately.

How do I get the actual displayed value, not the bound value for the column?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 16 Oct 2010, 09:49 PM
Hello Deborah,

Please let's move this move on with this discussion on this thread, i believe an universal solution would be better than a specific one.

Best Regads,
Emanuel Varga
0
Deborah
Top achievements
Rank 1
answered on 18 Oct 2010, 11:57 PM
The short answer to this question is that you cannot get the combobox displayed value of the column EXCEPT in the CellFormatting and RowFormatting events.

See the link in Emanuel's prior post for more information. 
Tags
GridView
Asked by
Deborah
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Deborah
Top achievements
Rank 1
Share this question
or