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

Grid with dropdown for insert and edit

3 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brendan Vogt
Top achievements
Rank 1
Brendan Vogt asked on 22 Aug 2008, 01:02 PM

Hi,

I have a column in my grid, here is the code:

<radG:GridBoundColumn
   DataField="Title.Description"
   HeaderText="Title"
   UniqueName="Title.Description">
</radG:GridBoundColumn>

The problem that I am having is the following..

  1. When the Insert new record link is clicked, this title field must become a dropdownlist with all the titles populated.
  2. When the Edit link is clicked, this title field must become a dropdownlist with all the titles populated, and the current title must be selected in the drop down.

Please can some one help me, I have been through the forums and can't find something suitable.

Thanks
Brendan

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 22 Aug 2008, 02:06 PM
Hello Brendan,

Please take a look at the following online demo:
RadGrid Automatic operations

The above illustrated functionality is achieved using regular GridDropDownColumn.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brendan Vogt
Top achievements
Rank 1
answered on 25 Aug 2008, 06:48 AM
Hi,

The example does it like this:

<telerik:GridDropDownColumn
   DataField="CategoryID"
   DataSourceID="SqlDataSource1"
   HeaderText="Category"
   ListTextField="CategoryName"
   ListValueField="CategoryID"
   UniqueName="CAtegoryID">
</telerik:GridDropDownColumn>

I previously had it my title text displayed like this in the grid, but then it became a textbox in the edit and insert:

<radG:GridBoundColumn
   DataField="Title.Description"
   HeaderText="Title"
   UniqueName="Title.Description">
</radG:GridBoundColumn>

How do I do the above the same for the GridDropDownColumn column?

Please help.

Brendan
0
Daniel
Telerik team
answered on 27 Aug 2008, 02:45 PM
Hello Brendan,

The code you provided is insufficient to supply an appropriate answer as there is no information about your datasource.

Quote from the documentation:

<rad:GridDropDownColumn 
UniqueName="LevelID" 
ListDataMember="Level" 
ListTextField="Description" 
ListValueField="LevelID" 
HeaderText="LevelID" 
DataField="LevelID" /> 

"As you can see, a requirement for the proper functioning of GridDropDownColumn is that all column values referenced by the DataField attribute match the column values referenced by the ListValueField attribute. If there are values in the LevelID column of the LevelID table which do not have corresponding equal values in the LevelID column of the Level table, then the grid will display the default first value from the Description column as it will not "know" what is the correct field."

Kind regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Brendan Vogt
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Brendan Vogt
Top achievements
Rank 1
Share this question
or