This question is locked. New answers and comments are not allowed.
Problem: master view switches in edit mode when I click on Edit button in nested grid
Please help to fix this problem
Please help to fix this problem
<% Html.Telerik().Grid(Model)
.Name("CustomerGrid")
.Columns(columns =>
{
columns.Bound(c => c.CustomerId).Title("CustomerId").Visible(false);
columns.Bound(c => c.CustomerName).Title("Customer");
columns.Bound(c => c.CustomerAddress).Title("Address");
columns.Command(comand =>
{
comand.Edit();
comand.Delete();
}).Title("Command");
})
.ToolBar(commands => commands.Insert())
.DataKeys(keys => keys.Add(c => c.CustomerId))
.DataBinding(dataBinding => dataBinding.Server()
//.Select("CustomerList", "Customer")
.Insert("InsertCustomer", "Customer")
.Update("EditCustomer", "Customer")
.Delete("DeleteCustomer", "Customer")
)
.DetailView(detailView => detailView.Template(c =>
{
%>
<% Html.Telerik().Grid<mProject>(c.Projects)
.Name("Projects_" + c.CustomerId.ToString())
.Columns(columns =>
{
columns.Bound(p => p.ProjectId).Visible(false);
columns.Bound(p => p.ProjectName).Width(340);
columns.Bound(p => p.ProjectCustomer).Width(340).Visible(false);
columns.Command(comand =>
{
comand.Edit();
comand.Delete();
}).Title("Command").Width(200);
})
.ToolBar(commands => commands.Insert())
.DataKeys(keys => keys.Add(p => p.ProjectId))
.DataKeys(keys => keys.Add(p => p.ProjectName))
.DataKeys(keys => keys.Add(p => p.ProjectCustomer))
.DataBinding(dataBinding => dataBinding.Server()
//.Select("ProjectListByCustomer", "Customer", new { ProjectCustomer = c.CustomerId })
.Delete("DeleteProject", "Customer")
.Insert("InsertProject", "Customer")
.Update("EditProject", "Customer")
)
.RowAction(row =>
{
if (row.Index == 0 && row.DetailRow != null)
{
row.DetailRow.Expanded = true;
}
else
{
var requestKeys = Request.QueryString.Keys.Cast<string>();
var expanded = requestKeys.Any(key => key.StartsWith("Projects_" + row.DataItem.ProjectId));
if (row.DetailRow != null)
row.DetailRow.Expanded = expanded;
}
if (row.InInsertMode)
{
row.DataItem.ProjectCustomer = c.CustomerId;
}
})
//.ClientEvents(e => e.OnDelete("OnDelete").OnSave("onSave"))
.Editable(e => e.DisplayDeleteConfirmation(true))
.PrefixUrlParameters(false)
.Pageable()
.Sortable()
.Filterable()
.Selectable()
.Render();
%>
<%
}))
.Sortable()
.Filterable()
//.Selectable()
.Editable(e => e.DisplayDeleteConfirmation(true))
.ClientEvents(events => events.OnDetailViewExpand("onExpand"))
.Pageable(builder => builder.PageSize(10))
.Groupable()
.Scrollable(scrolling => scrolling.Height(500))
.PrefixUrlParameters(false)
.Render();
%>
3 Answers, 1 is accepted
0
Daniel
Top achievements
Rank 1
answered on 15 Sep 2010, 11:20 PM
I really don't understand 100% your question, but I think that the problem can be resolved if you use Ajax Binding.
Why? Because Server Binding reload the View every time you change current page, filter, click a button, etc.
In Ajax Binding only the Grid is reloaded, and don't affect other controls on the page.
Daniel.
Why? Because Server Binding reload the View every time you change current page, filter, click a button, etc.
In Ajax Binding only the Grid is reloaded, and don't affect other controls on the page.
Daniel.
0
Joan Vilariño
Top achievements
Rank 2
answered on 16 Sep 2010, 08:17 AM
Hi Rafael, I don't know if it's the same problem... but it's the same behavior...
In my case, I had a nested grid with a template column. The templae contained a Telerik().ComboBox control on it. Well, if I set .DropDownHtmlAttributes() to anything in that template, I get the same behavior like the one you're describing. When you click "Edit" in the nested grid, is the master grid the one that enters edit mode instead of the nested one.
This behavior dissapears when I remove the .DropDownHtmlAttributes() line in my template (thus, making the combobox look uglier, but at least it works).
Check your project to see if it can be the same problem.
I was going to submit this bug today xD
Cheers!!
In my case, I had a nested grid with a template column. The templae contained a Telerik().ComboBox control on it. Well, if I set .DropDownHtmlAttributes() to anything in that template, I get the same behavior like the one you're describing. When you click "Edit" in the nested grid, is the master grid the one that enters edit mode instead of the nested one.
This behavior dissapears when I remove the .DropDownHtmlAttributes() line in my template (thus, making the combobox look uglier, but at least it works).
Check your project to see if it can be the same problem.
I was going to submit this bug today xD
Cheers!!
0
Rafael
Top achievements
Rank 1
answered on 16 Sep 2010, 01:37 PM
Joan, I faced with the problem you described in post, but resolve it playing with .Selectable, .Editing properties for master and details view.
And know when I click on Edit button my nested view doesn't switch in Edit mode, also the nested grid has Editable property On
Generally, I wonder is it possible to edit row in nested grid when server binding is using? how GridRouteValues() function helps to maintain View's mode
And know when I click on Edit button my nested view doesn't switch in Edit mode, also the nested grid has Editable property On
Generally, I wonder is it possible to edit row in nested grid when server binding is using? how GridRouteValues() function helps to maintain View's mode