This question is locked. New answers and comments are not allowed.
My code looks like:
I am wanting to insert a new Item in a details view inside another details View (which would be my PollsQuestion DetailsView Grid). It seems that when I run my code I get the error:
Exception Details: System.ArgumentException "The key with the following name "NoRecords" was not found. Please update all localization files."
Which points to my PollQuestionsGrid details view.
But if I put an if (x.Poll.PollQuestions.Count() != 0) around this grid then I get no grid which stops me from adding a new PollQuestion.
Hope thats enough info
Thx
<% Html.Telerik() .Grid<Mod.Data.Streampac.AgendaPoint>(this.Model) .Name(string.Format("AgendaPointGrid_{0}", 0)) .DetailView(detailView => detailView.Template(a => { Html.Telerik() .Grid<Mod.Data.Streampac.Polls_AgendaPoint>(a.Polls_AgendaPoints) .Name(string.Format("PollsGrid_{0}", a.AgendaPointID)) .ToolBar(commands => commands.Insert()) .DataBinding(dataBinding => { dataBinding.Server() .Select("EditPoll", "Polls", new { micrositeId = worky.MicrositeId, eventId = worky.Event.EventID }) .Insert("InsertPoll", "Polls", new { micrositeId = worky.MicrositeId, eventId = worky.Event.EventID, agendaId = a.AgendaPointID }) .Delete("DeletePoll", "Polls", new { micrositeId = worky.MicrositeId, eventId = worky.Event.EventID, agendaId = a.AgendaPointID }) .Update("UpdatePoll", "Polls", new { micrositeId = worky.MicrositeId, eventId = worky.Event.EventID, agendaId = a.AgendaPointID }); }) .Columns(columns => { columns.Bound(e => e.PollID).Width(105).ReadOnly(); columns.Bound(e => e.Poll.PollTitle).Width(130).Encoded(false); columns.Bound(e => e.Poll.PollDescription).Width(400).Encoded(false); columns.Command(commands => { commands.Edit(); commands.Delete(); }).Width(50); }) .Sortable(sorting => sorting .OrderBy(sortOrder => sortOrder.Add(o => o.PollID).Descending())) .Filterable() .Pageable() .Resizable(resize => resize.Columns(true)) .DataKeys(keys => { keys.Add(e => e.PollID).RouteKey("id"); //keys.Add(e => e.Speaker).RouteKey("speaker"); }) //-------------------------------- Poll Questions ----------------------------------------- .DetailView(detailViewPollQ => detailViewPollQ.Template(x => { // if (x.Poll.PollQuestions.Count() != 0) // { Html.Telerik() .Grid<Mod.Data.Streampac.PollQuestion>(x.Poll.PollQuestions) .Name(string.Format("PollQuestionsGrid_{0}", x.AgendaPointID)) .ToolBar(commands => commands.Insert()) .DataBinding(dataBinding => { dataBinding.Server() .Select("EditQuestion", "Polls", new { micrositeId = worky.MicrositeId, eventId = worky.Event.EventID }) .Insert("InsertQuestion", "Polls", new { micrositeId = worky.MicrositeId, eventId = worky.Event.EventID }) .Delete("DeleteQuestion", "Polls", new { micrositeId = worky.MicrositeId, eventId = worky.Event.EventID }) .Update("UpdateQuestion", "Polls", new { micrositeId = worky.MicrositeId, eventId = worky.Event.EventID, agendaId = a.AgendaPointID }); }) .Columns(columns => { columns.Bound(v => v.PollQuestionID).Width(105).ReadOnly(); columns.Bound(v => v.QuestionText).Width(400).Encoded(false); columns.Command(commands => { commands.Edit(); commands.Delete(); }).Width(50); }) .Sortable() .Filterable() .Pageable() .Resizable(resize => resize.Columns(true)) .DataKeys(keys => { keys.Add(v => v.PollQuestionID).RouteKey("questionId"); //keys.Add(e => e.Speaker).RouteKey("speaker"); }) .Render(); // } })) .Render(); })) .RowAction(row => { if (row.Index == 0) { row.DetailRow.Expanded = true; } else { var requestKeys = Request.QueryString.Keys.Cast<string>(); var expanded = requestKeys.Any(key => key.StartsWith("PollsGrid_")); row.DetailRow.Expanded = expanded; } }) // --------------------------- AgendaGrid code starts again ------------------------------------------------ //.DataBinding(dataBinding => // { // dataBinding.Server() // .Select("EditSpeaker", "Speakers", new { micrositeId = worky.MicrositeId }) // .Insert("InsertSpeaker", "Speakers", new { micrositeId = worky.MicrositeId }) // .Delete("DeleteSpeaker", "Speakers", new { micrositeId = worky.MicrositeId }) // .Update("UpdateSpeaker", "Speakers", new { micrositeId = worky.MicrositeId }); // }) .Columns(columns => { columns.Bound(e => e.AgendaPointID).Width(105).ReadOnly(); columns.Bound(e => e.AgendaPointTitle).Width(130).Encoded(false); //columns.Command(commands => //{ // commands.Edit(); // commands.Delete(); //}).Width(50); }) .Sortable() .Filterable() .Pageable() .Resizable(resize => resize.Columns(true)) .DataKeys(keys => { keys.Add(e => e.AgendaPointID) .RouteKey("AgendaId"); }) .Render(); %>I am wanting to insert a new Item in a details view inside another details View (which would be my PollsQuestion DetailsView Grid). It seems that when I run my code I get the error:
Exception Details: System.ArgumentException "The key with the following name "NoRecords" was not found. Please update all localization files."
Which points to my PollQuestionsGrid details view.
But if I put an if (x.Poll.PollQuestions.Count() != 0) around this grid then I get no grid which stops me from adding a new PollQuestion.
Hope thats enough info
Thx