This question is locked. New answers and comments are not allowed.
i'm trying to build a page with an editable grid in an editable grid.
view:
the parent ("Contacts") edit works perfect, but in the child ("Notities") grid i'm not able to get the id ("NoteId") of the parent grid.
i need this to save the child row.
both id's are in the model.
Is it possible to get the id of the parent grid?
thanks in advance for reply.
btw, this mvc suite really rocks!
view:
@(Html.Telerik().Grid<ContactModel>() .Name("Contacts") .Localizable("nl-NL") .DataKeys(keys => { keys.Add(c => c.ContactId); }) .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image).ImageHtmlAttributes(new { style = "margin-left:0" })) .Columns(columns => { columns.Bound(e => e.Category); columns.Bound(e => e.CompanyName); columns.Bound(e => e.Name); columns.Bound(e => e.TelephoneNumber); columns.Bound(e => e.MobileNumber); columns.Bound(e => e.Email); columns.Bound(e => e.BirthDate).Format("{0:dd-MM-yyyy}"); columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Image); commands.Delete().ButtonType(GridButtonType.Image); }); }) .DetailView(details => details.ClientTemplate( Html.Telerik().TabStrip() .Name("Tabstrip_<#= ContactId #>") .SelectedIndex(0) .Items(items => { items.Add().Text("Detail Informatie") .Content("<div class='employee-details'>" + "<ul>" + "<li><label>Soort Contact</label><#= Category #></li>" + "<li><label>Bedrijsnaam</label><#= CompanyName #></li>" + "<li><label>Naam</label><#= Name #></li>" + "<li><label>Telefoonnummer</label><#= TelephoneNumber #></li>" + "<li><label>Mobiel nummer</label><#= MobileNumber #></li>" + "<li><label>Emailadres</label><#= Email #></li>" + "<li><label>WebSite</label><a href='http://<;#= Website #>' target='_blank'><#= Website #></a></li>" + "<li><label>Geboortedag</label><#= $.telerik.formatString('{0:dd-MM-yyyy}', BirthDate)#></li>" + "</ul>" + "</div>"); items.Add().Text("Adressen").Content( Html.Telerik().Grid<AddressModel>() .Name("Adresses_<#= ContactId #>") .Columns(columns => { columns.Bound(o => o.AddressName); columns.Bound(o => o.Street); columns.Bound(o => o.PostalCode); columns.Bound(o => o.Town); }) .DataBinding(dataBinding => dataBinding.Ajax() .Select("_AddressesForContact", "Contact", new { id = "<#= ContactId #>" })) .Pageable() .Sortable() .Filterable() .ToHtmlString()); items.Add().Text("Notities").Content( Html.Telerik().Grid<NoteModel>() .Name("Notes_<#= ContactId #>") .Localizable("nl-NL") .DataKeys(keys => { keys.Add(c => c.NoteId); }) .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image)) .Columns(columns => { columns.Bound(o => o.TimeStamp).ReadOnly(); columns.Bound(o => o.Note); columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Image); commands.Delete().ButtonType(GridButtonType.Image); }); }) .DataBinding(dataBinding => dataBinding.Ajax() .Select("_NotesForContact", "Contact", new { id = "<#= ContactId #>" }) .Insert("_InsertNoteForContact", "Contact", new { id = "<#= ContactId #>" }) .Update("_UpdateNoteForContact", "Contact", new { id = "<#= NoteId #>", contactId = "<#= ContactId #>" }) .Delete("_DeleteNoteForContact", "Contact", new { id = "<#= NoteId #>", contactId = "<#= ContactId #>" })) .Sortable() .Filterable() .ToHtmlString()); items.Add().Text("Emails").Content( Html.Telerik().Grid<EmailMessageModel>() .Name("Emails_<#= ContactId #>") .Columns(columns => { columns.Bound(o => o.TimeStamp); columns.Bound(o => o.Message); }) .DataBinding(dataBinding => dataBinding.Ajax() .Select("_EmailsForContact", "Contact", new { id = "<#= ContactId #>" })) .Sortable() .Filterable() .ToHtmlString()); }) .ToHtmlString() )) .DataBinding(dataBinding => { dataBinding.Ajax() .Select("_AllContacts", "Contact") .Insert("_InsertContact", "Contact") .Update("_SaveContact", "Contact") .Delete("_DeleteContact", "Contact"); }) .Editable(editing => editing.Mode(GridEditMode.PopUp)) .Sortable() .Filterable() ) the parent ("Contacts") edit works perfect, but in the child ("Notities") grid i'm not able to get the id ("NoteId") of the parent grid.
i need this to save the child row.
both id's are in the model.
Is it possible to get the id of the parent grid?
thanks in advance for reply.
btw, this mvc suite really rocks!