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

[Solved] Binding Dropdown in the Teleri MVC Grid

2 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Syed
Top achievements
Rank 1
Syed asked on 09 Nov 2011, 01:53 PM

I try to add a drop down list in the telerik mvc grid. In one of my grid column the drop down should be appear with data in all the rows.
Below is my code snippet. But it is not reflecting. Apreciate for any help

@(Html.Telerik().Grid(Model).Name(

 

"Grid").

 

DataKeys(keys => keys.Add(o => o.Account)).DataBinding(dataBinding => dataBinding.Ajax()

 

 

.Select("Edit", "Pap", new { mode = GridEditMode.PopUp, type = GridButtonType.Text })

 

.Update(

 

"Update", "Pap", new { mode = GridEditMode.PopUp, type = GridButtonType.Text })

 

.Delete(

 

"Delete","Pap")).

 

 

Columns(columns =>

{

columns.Template(@<text>

 

<input type="checkbox" name="ck"

 

 

 

value="Pap" class="chkPap"/>

 

</text>).HeaderTemplate(@<text>

 

<label>Pap</label>

 

 

 

<input id="chkallPap" type="checkbox" title="check all records" onclick="checkallPap();"

 

 

 

/></text>);

 

columns.Bound(o => o.Account);

columns.Bound(o => o.PrimaryEmail);

 

 

//columns.Command(commands => commands.Edit().ButtonType(GridButtonType.Text));

 

columns.Bound(o => o.OptionalEmail)

.ClientTemplate(Html.Telerik().DropDownList().Name(

 

"OptionalEmailDropdownlist")

 

.BindTo(

 

new SelectList
(GetOptionalEmail(),"PapDropdownListValue","PapDropdownListText")).ToHtmlString());

 

columns.Command(commands =>

{

commands.Edit().ButtonType(

 

GridButtonType.Text);

 

commands.Delete().ButtonType(

 

GridButtonType.Text);

 

});

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Nov 2011, 12:20 PM
Hi Syed,

As I understand it, you wish to edit a column in your grid using a DropDownList, am I right? If this is so, please find attached a small sample that implements this functionality.

If this is not your scenario, please send additional information about what you wish to accomplish. 


Greetings,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Pedro
Top achievements
Rank 1
answered on 03 Apr 2012, 11:36 AM
Hi,
I followed the described solution, but can´t get the droplist to "open" up. I only see the first record and can´t change it.
Any ideas on this?
thank you!
regards
Pedro
Tags
Grid
Asked by
Syed
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Pedro
Top achievements
Rank 1
Share this question
or