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

[Solved] Bind Combobox to Grid Column

5 Answers 141 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roland
Top achievements
Rank 1
Roland asked on 15 Nov 2011, 03:51 PM
I was wondering if anyone has an example of binding a combobox to a grid column similar to the way Excel column filters work. The combobox would fill with the distinct values from the bound grid column.

5 Answers, 1 is accepted

Sort by
0
Douglas
Top achievements
Rank 1
answered on 30 Apr 2012, 08:08 PM
did you ever figure this out?

i'm having the same problem..

thanks

doug
0
Pechka
Top achievements
Rank 1
answered on 01 May 2012, 06:05 AM
Hello,

Use the foreign key column feature http://demos.telerik.com/aspnet-mvc/grid/foreignkeycolumn 
0
Roland
Top achievements
Rank 1
answered on 01 May 2012, 02:23 PM
I don't think I phrased my question properly so let me rephrase. Our users do not like the complexity of the standard column filters and want us to replace them with a drop-down combobox that will allow them to choose a value. If possible it would be nice to allow the user to choose multiple values (similar to reporting services and Excel filters).
0
Roland
Top achievements
Rank 1
answered on 01 May 2012, 02:28 PM
Doug, sorry I did not see your email until today. I did not solve the problem. Instead I presented a number of filter inputs (text and combobox) above the column headers in a form. The users can fill out what they like and then click a "Filter" button which re-loads the deata using the filters. If you're just wanting a combobox for inline editing the comment below suggesting the foreign key column will work but you do have to bind to some kind of lookup list.
0
Douglas
Top achievements
Rank 1
answered on 01 May 2012, 02:57 PM
I think I misunderstood the original question.

What I'm trying to accomplish is simply placing a dropdown control in place of a text box in a ClientTemplate like this:

columns.Bound(o => o.Description).Width(65)
                      .ClientTemplate(Html.Telerik().ComboBox()
                      .Name("Special")
                      .DataBinding(new SelectList(ViewBag.ValueList))
                      .ToHtmlString());

Which may be a little simpler that what you were trying to accomplish.

I saw a post where someone was using the ViewBag property, however that's not working probably because I'm using Ajax databinding to bind my grid like this:

.DataBinding(dataBinding => dataBinding.Ajax()
            .Select("_Index", "ItemInfo")
            .Update("_SaveBatchEditing", "ItemInfo")
            )



Thanks..

Doug
Tags
ComboBox
Asked by
Roland
Top achievements
Rank 1
Answers by
Douglas
Top achievements
Rank 1
Pechka
Top achievements
Rank 1
Roland
Top achievements
Rank 1
Share this question
or