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

Trying to use a griddropdowncolumn for state abbreviations

3 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kathy
Top achievements
Rank 1
Kathy asked on 02 Oct 2010, 12:01 AM
This seems like something that would be fairly straightforward to do.  In my grid, I want to have the 2 letter state abbreviation show up as a gridbound column.  But, when you go to edit or create a new record, I want the state column to be a griddropdowncolumn.  I'm would like to use the autogenerated form for this, not have it be inline edit.  What's the best way to go about this?  Thanks.

3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 05 Oct 2010, 01:14 PM
Hi Kathy,

You can achieve this by using the GridDropDownColumn, as it is displayed as a simple label in normal mode and it shows the data in a dropdown when the grid switches to edit mode. You need to set its DataSourceID and DataFiled properties for the column to bind correctly. You can additionally configure the column by setting ListValueField, ListTextField. Here is a sample code:
<telerik:GridDropDownColumn DataField="CategoryID" 
  DataSourceID="SqlDataSource1" HeaderText="Category" 
  ListTextField="CategoryName" 
  ListValueField="CategoryID" UniqueName="CategoryID">
</telerik:GridDropDownColumn>

SqlDataSource1 should contain the state abbreviations. And DataField should point to the relevant filed. You may find additional information on the GridDropDownColumn in this help topic and live demo.

Hope this helps.

Kind regards,
Marin
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Harsh
Top achievements
Rank 1
answered on 23 May 2011, 09:13 AM
I am also using the GridDropDown column but the drop down list is not opening while in-line editing.I can see while debugging that the list controls has 3 rows but only the first row is shown during the inline editing.
0
Princy
Top achievements
Rank 2
answered on 23 May 2011, 09:46 AM
Hello Harsh,

I am not quite sure about the scenario. Please take a look at the following Demo and make a double check with your code.
Grid / Column Types.

Thanks,
Princy.
Tags
Grid
Asked by
Kathy
Top achievements
Rank 1
Answers by
Marin
Telerik team
Harsh
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or