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

[Solved] Setting the Edit Template with Ajax Bound Grids

0 Answers 16 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.
Heath
Top achievements
Rank 1
Heath asked on 26 Sep 2011, 07:05 PM
After much searching I've determined that display/editor templates won't work for my problem because I'm binding my grid in ajax mode. The good news is I then discovered ClientTemplates which worked for displaying my column the way I wanted. But the bad news is I lose this when I pull up the edit template via pop-up.

I've been looking at the possibility of using the WindowBuilder but as of yet I haven't determined exactly how to do that in my case.

@( Html.Telerik().Grid<UserSearchModel>()
        .Name("Grid")
        .DataKeys(keys => { keys.Add(p => p.UserId); })
        .Columns(columns =>
               {
                   columns.Bound(o => o.UserId).Visible(false) ;
                   if(Context.User.IsInRole("Admin")) columns.Bound(o=>o.CompanyName).Width(100);
                   columns.Bound(o => o.RolesModel).ClientTemplate("<strong><#= RolesModel.RoleName #></strong>");
                   columns.Command(commands =>
                   {
                       commands.Edit().ButtonType(type);
                   }).Width(180).Title("Commands");       
               })
        .DataBinding(dataBinding => dataBinding.Ajax()
                       .Select("_AjaxBinding", "Users")
                               .Update("Edit", "Users")
                                   .Insert("Create", "Users")
                     )
        .Resizable(resizing => resizing.Columns(true))
        .Reorderable(reorder => reorder.Columns(true))
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Pageable(p=> p.PageSize(13))
        .Sortable()
        .Scrollable(scrolling => scrolling.Height("400px"))
        .Groupable()
        .Filterable()
 
       
)
Tags
Grid
Asked by
Heath
Top achievements
Rank 1
Share this question
or