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

[Solved] Best Way to embed controls into grid cell

0 Answers 19 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.
Steve
Top achievements
Rank 1
Steve asked on 09 Apr 2011, 12:43 AM

I am hoping for some direction on how to implement a dropdown in a MVC grid cell.

We have extended the Teleric dropdown to include some nifty features and would like to use that control and embed it into a grid cell of a MVC grid.  The grid contains a list of receipt items and the final column needs contain this dropdown.  If the user selects it, they will be able to choose 1 or more options from a list of available rejection reasons.  The last option of the dropdown is a textbox where the user can enter a custom rejection reason.  When loading the grid, the ReceiptItemModel has a property that is a list of currently selected rejection reasons. 

I am using AJAX binding.

I looking for some suggestions on how to construct and populate the rejection reason dropdown clienttemplate.  I included a grid example with a couple of notes.

Cant use a Template column cause I am Ajax binding.  Cant seem to come up with a good way to build out the client template.

Any suggestions would be greatly appreciated.

(

<%=Html.Telerik().Grid<ReceiptItemModel>()
                          .Name(Grid.ReceiptDetailsGrid)
                          .HtmlAttributes(new {style = "font-size: 11px;"})
                          .Columns(columns =>
                                       {
                                           columns.Bound(ri => ri.Item.Line)
                                               .Title(
                                                   Html.GetGlobalLocalizedResource<OrdersLanguageMVC>(
                                                       x => OrdersLanguageMVC.ReceiptLineNumber))
                                               .Width(150);
                                           columns.Bound(ri => ri.Item.Conditions /* Generic List of condition objects */)
                                               .ClientTemplate("Need to do something here that creates html for drop down using  ri.Item.Conditions  ")
                                               .Width(90)
                                               .Sortable(true)
                                               .Title(
                                                   Html.GetGlobalLocalizedResource<OrdersLanguageMVC>(
                                                       x => OrdersLanguageMVC.RejectionReason))
                                               .Groupable(false);
                                       })
                          .Configurable()
                          .EnableCustomBinding(true)
                          .DataBinding(dataBinding => dataBinding.Ajax().Select("ReceiptItems""ReceiptDetail"))
%>)
Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Share this question
or