This question is locked. New answers and comments are not allowed.
Hi,
I try to get a variable thanks to <#= test #> in a child grid but I get an error: "test" does not exist.
Thanks for your answers.
Here is my view:
I try to get a variable thanks to <#= test #> in a child grid but I get an error: "test" does not exist.
Thanks for your answers.
Here is my view:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" UICulture="en-US"%><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> CDS Dashboard</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <%= Html.Telerik().Grid((IEnumerable<TelerikMvcApplication1.Models.Movement>)ViewData["Movements"]) .Name("Movements") .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image)) .DataKeys(keys => keys.Add(o => o.REFERENCE).RouteKey("test")) .Columns(columns => { columns.Bound(o => o.REFERENCE).Width(130).Title("Reference"); columns.Bound(o => o.TITLE).Width(250).Title("Title"); columns.Bound(o => o.TYPE_CODE).Title("Type"); columns.Bound(o => o.STATUS_CODE).Title("Status"); columns.Bound(o => o.SEVERITY_CODE).Title("Severity"); columns.Bound(o => o.IN_CHARGE).Title("In charge"); columns.Bound(o => o.REQUEST_DATE).Format("{0:dd/MM/yyyy}").Title("Request Date"); columns.Bound(o => o.PROCESSING_DATE).Format("{0:dd/MM/yyyy}").Title("Processing Date"); columns.Bound(o => o.DELIVERY_DATE).Format("{0:dd/MM/yyyy}").Title("Delivery Date"); columns.Bound(o => o.CLOSING_DATE).Format("{0:dd/MM/yyyy}").Title("Closing Date"); columns.Bound(o => o.TYPE_CODE_SIG).Title("Type SIG"); columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Image); commands.Delete().ButtonType(GridButtonType.Image); }).Width(80); }) .RowAction(row => { if (!row.DataItem.DELIVERY_DATE.HasValue) { row.HtmlAttributes["style"] = "background:red;"; } if (row.InEditMode) { ViewData["stat"] = row.DataItem.STATUS_CODE; ViewData["sev"] = row.DataItem.SEVERITY_CODE; ViewData["type"] = row.DataItem.TYPE_CODE; ViewData["sig"] = row.DataItem.TYPE_CODE_SIG; } }) .Editable(editing => editing.Mode(GridEditMode.PopUp).DefaultDataItem(new TelerikMvcApplication1.Models.Movement {REFERENCE = "111111-A.11" })) .Pageable(pase => pase.PageSize(7)) .Resizable(resizing => resizing.Columns(true)) .Selectable() .ClientEvents(events => events.OnError("onError").OnRowDataBound("movements_onRowDataBound")) .DataBinding(dataBinding => dataBinding .Ajax() .Select("_SelectionMovements", "Choice") .Insert("Insert", "Choice") .Update("Save", "Choice") .Delete("Delete", "Choice")) .Filterable() .Sortable() .DetailView(details => details.ClientTemplate( Html.Telerik().Grid<TelerikMvcApplication1.Models.Comment>() .Name("Comments_<#= test #>") .Columns(columns => { columns.Bound(o => o.COMMENT).Width(101); columns.Bound(o => o.DATE).Format("{0:dd/MM/yyyy}"); }) .ClientEvents(events => events.OnRowDataBound("comments_onRowDataBound")) .DataBinding(dataBinding => dataBinding.Ajax() .Select("_SelectionComments", "Choice", new { movementID = "<#= test #>" })) .Pageable() .Sortable() .Filterable() .ToHtmlString() )) .Pageable(paging => paging.PageSize(5)) .Scrollable(scrolling => scrolling.Height(580)) .Sortable() %><script type="text/javascript"> function expandFirstRow(grid, row) { if (grid.$rows().index(row) == 0) { grid.expandRow(row); } } function movements_onRowDataBound(e) { var grid = $(this).data('tGrid'); expandFirstRow(grid, e.row); } function comments_onRowDataBound(e) { var grid = $(this).data('tGrid'); expandFirstRow(grid, e.row); } function onMoveSelected(e) { var commentsGrid = $('#Comments').data('tGrid'); var movementID = e.row.cells[0].innerHTML; // update ui text $('#movementID').text(movementID); // rebind the related grid commentsGrid.rebind({ movementID: movementID }); } function onEditComm(e) { var commentsGrid = $('#Comm').data('tGrid'); alert("you"); // rebind the related grid } function onDelete(e) { var commentsGrid = $('#Comments').data('tGrid'); movementID = e.dataItem.ID_MOVEMENT; alert(e.dataItem.ID_MOVEMENT); // update ui text $('#movementID').text(movementID); // rebind the related grid commentsGrid.rebind({ movementID: movementID }); } function onError(e) { if (e.textStatus == 'error') { if (e.XMLHttpRequest.status == "500") { alert("The server was unable to process your request.\n" + e.XMLHttpRequest.responseText); e.preventDefault(); } } }
</script><style type="text/css"> /* in-form editing */ .t-edit-form-container { width: 300px; margin: 1em; } </style><%: Html.Telerik().ScriptRegistrar() %></asp:Content>