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

[Solved] Telerik Nested Grid DefaultItem

0 Answers 20 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
GTL EMS
Top achievements
Rank 1
GTL EMS asked on 22 Feb 2012, 05:13 AM
Hello Team,

I have created nestead grid as below, what I want to when user create new record it should automatically get the parent (CategoryRecordID) and use the same. in below code I have tried below but no success.

.Editable(editing => editing.Mode(

GridEditMode.PopUp).DefaultDataItem(new EnvyLaser.Entity.Service() { ServiceCategoryIDText = "<#= ServiceCategoryID #>" }))



It's storing text servicecategoryID instead of servicecategoryId's value.

How can I achive this?
  @(
Html.Telerik().Grid<EnvyLaser.Entity.ServiceCategory>()
               .Name("ServiceCategories")
       .ToolBar(commands => commands.Insert())
       .DataKeys(keys => { keys.Add(p => p.ServiceCategoryID); })
       .Columns(columns =>
       {
           columns.Bound(o => o.ServiceCategoryName);
           columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Image); commands.Delete().ButtonType(GridButtonType.Image); }).Width(180).Title("Commands");
       })
       .DataBinding(dataBinding =>
       {
           dataBinding.Ajax().Select("_Index", "ServiceCategory").
               Insert("_InsertAjaxEditing", "ServiceCategory").
               Update("_SaveAjaxEditing", "ServiceCategory").
               Delete("_DeleteAjaxEditing", "ServiceCategory");
       })
       .Sortable(sorting => sorting.Enabled(true))
       .Pageable(paging => paging.Enabled(true).PageSize(10).Style(GridPagerStyles.PageSizeDropDown | GridPagerStyles.NextPreviousAndNumeric).Position(GridPagerPosition.Both))
       .Editable(editing => editing.Mode(GridEditMode.PopUp))
       .Filterable(filtering => filtering.Enabled(true))
       .ClientEvents(events => events.OnRowDataBound("categories_onRowDataBound"))
       .Footer(true)
       .DetailView(details => details.ClientTemplate(Html.Telerik().Grid<EnvyLaser.Entity.Service>()
       .Name("Services_<#= ServiceCategoryID #>")
       .ToolBar(commands => commands.Insert())
       .DataKeys(keys => { keys.Add(p => p.ServiceID); })
       .Columns(columns =>
       {
           columns.Bound(o => o.ServiceName);
           columns.Bound(o => o.ServicePrice);
           columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Image); commands.Delete().ButtonType(GridButtonType.Image); }).Width(180).Title("Commands");
       })
       .DataBinding(dataBinding =>
       {
           dataBinding.Ajax().Select("_Index", "Services", new { serviceCategoryID = "<#= ServiceCategoryID #>" }).
               Insert("_InsertAjaxEditing", "Services").
               Update("_SaveAjaxEditing", "Services").
               Delete("_DeleteAjaxEditing", "Services");
       })
       .Sortable(sorting => sorting.Enabled(true))
       .Pageable(paging => paging.Enabled(true).PageSize(10).Style(GridPagerStyles.PageSizeDropDown | GridPagerStyles.NextPreviousAndNumeric).Position(GridPagerPosition.Both))
       .Editable(editing => editing.Mode(GridEditMode.PopUp).DefaultDataItem(new EnvyLaser.Entity.Service() { }))
       .Filterable(filtering => filtering.Enabled(true))
       .Footer(true).ToHtmlString())
       ))

Tags
General Discussions
Asked by
GTL EMS
Top achievements
Rank 1
Share this question
or