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

[Solved] Editing and Master/Detail

1 Answer 121 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.
Oniano
Top achievements
Rank 1
Oniano asked on 15 Jul 2011, 05:25 PM
I want to be able to edit the detail grid. I have set up a master detail as follows, but I'm seeing some weird behaviour.

<%      Html.Telerik().Grid <
Event>(Model)
          .Name("grdEventConfig")
          .ClientEvents(events =>
              events.OnError("Grid_onError")
              )
          .Editable(editing => editing.Mode(GridEditMode.InCell))
          .DataKeys(keys =>
              {
                  keys.Add(p => p.Id);
              })
          .ToolBar(commands =>
              {
                  commands.Insert();
                  commands.SubmitChanges();
              })
          .DataBinding(dataBinding =>
              dataBinding.Ajax()
                  .Select("_SelectBatchEditing", "Event")
                  .Update("_SaveBatchEditing", "Event")
              )           
          .Columns(columns =>
              {
                columns.Bound(o => o.Id);
                  columns.Bound(o => o.Name);
                  columns.Bound(o => o.Description);
                  columns.Bound(o => o.OkOutputValue);
                  columns.Bound(o => o.FailOutputValue);
                  columns.Command(commands => commands.Delete()).Width(80).Title("Delete");
              })
          .DetailView(detailView => detailView.ClientTemplate(
                      Html.Telerik().Grid<EventParameter>()
                      .Name("EventParameter_<#= Id #>")
                      .Editable(editing => editing.Mode(GridEditMode.InCell))
                      .Columns(columns =>
                      {
                        columns.Bound(ep => ep.Id);
                        columns.Bound(ep => ep.FieldName);
                        columns.Bound(ep => ep.FieldValue);
 
                      })
                      .DataKeys(dataKeys => dataKeys.Add(ep => ep.Id))
                      .DataBinding(db => db.Ajax().Select("_SelectEventParameter","Event", new {eventId = "<#= Id #>"}).Update("_UpdateEventParameter","Event")).ToHtmlString())
 
          ).Render();
%>

When I expand the Detail, I get an input box rather than a grid. When I press 'Cancel changes' and expand the detail again, the Detail grid appears. I can't edit the Master or the Detail.  Am I missing something?

Thanks for the help.

1 Answer, 1 is accepted

Sort by
0
Oniano
Top achievements
Rank 1
answered on 15 Jul 2011, 05:29 PM
Also, how do I separate text and code in a forum post?
Tags
Grid
Asked by
Oniano
Top achievements
Rank 1
Answers by
Oniano
Top achievements
Rank 1
Share this question
or