Hi,
I'm trying to filter on value from parent GRID (dynamically)
.Filter(filter => filter.Add(prod => prod.COUNTER_PRNITER_ID).IsEqualTo(decimal.Parse("# =PRINTER_ID#")))
But he try to parse the string not the value of printer id
the COUNTER_PRNITER_ID is the Forgen KEY of the PRINTER_ID (Parent KEY)
I want to show in the second GRID only the data that belong to selected printer
Kan somebody help me?
Thanks in advance
Dmitriy Utsmiyev
Sample code below
@(Html.Kendo().Grid((IEnumerable<KendoUIMvcLoginApp.Models.Data.Printer>)ViewBag.Printers)
.Name("grid")
.Columns(columns =>
{
columns.Bound(e => e.PRINTER_NAME).Title("Printer Name");
columns.Bound(e => e.PRINTER_IP).Hidden();
columns.Bound(e => e.PRINTER_ID).Hidden();
columns.Bound(e => e.PRINTER_MIB_ID).Hidden();
columns.Command(command => command.Custom("Start").Click("showDetails")).Width(50);
})
.ClientDetailTemplateId("template")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HierarchyBinding_Employees", "Grid"))
)
.Events(events => events.DataBound("dataBound"))
)
<script id="template" type="text/x-kendo-template">
@(Html.Kendo().TabStrip()
.Name("tabStrip_#=PRINTER_ID#")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("Test Counters").Content(@<text>
@(Html.Kendo().Grid((IEnumerable<KendoUIMvcLoginApp.Models.Data.Counter>)ViewBag.Counters)
.Name("grid_#=PRINTER_ID#")
.Columns(columns =>
{
columns.Bound(o => o.COUNTER_NAME).Title("Name");
columns.Bound(o => o.COUNTER_VALUE).Title("Value");
columns.Bound(o => o.COUNTER_PRICE).Title("Price");
columns.Bound(o => o.COUNTER_PRICE_TOTAL).Title("Total Price");
columns.Bound(o => o.COUNTER_PRNITER_ID).Title("ID");
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=PRINTER_ID#" }))
.Filter(filter => filter.Add(prod => prod.COUNTER_PRNITER_ID).IsEqualTo(decimal.Parse("# =PRINTER_ID#")))
)
.Sortable()
.ToClientTemplate())
</text>
);
items.Add().Text("Printer Information").Content(
"<div class='employee-details'>" +
"<ul>" +
"<li><label>Printer:</label>#= PRINTER_NAME #</li>" +
"<li><label>Ip address:</label>#= PRINTER_IP #</li>" +
"<li><label>ID:</label>#= PRINTER_ID #</li>" +
"<li><label>MIB:</label>#= PRINTER_MIB_ID #</li>" +
"</ul>" +
"</div>"
);
})
.ToClientTemplate())
</script> <script>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</script>
<script>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</script>
<style scoped="scoped">
.k-detail-cell .k-tabstrip .k-content {
padding: 0.2em;
}
.employee-details ul
{
list-style:none;
font-style:italic;
margin: 15px;
padding: 0;
}
.employee-details ul li
{
margin: 0;
line-height: 1.7em;
} .employee-details label
{
display:inline-block;
width:90px;
padding-right: 10px;
text-align: right;
font-style:normal;
font-weight:bold;
}
</style>
I'm trying to filter on value from parent GRID (dynamically)
.Filter(filter => filter.Add(prod => prod.COUNTER_PRNITER_ID).IsEqualTo(decimal.Parse("# =PRINTER_ID#")))
But he try to parse the string not the value of printer id
the COUNTER_PRNITER_ID is the Forgen KEY of the PRINTER_ID (Parent KEY)
I want to show in the second GRID only the data that belong to selected printer
Kan somebody help me?
Thanks in advance
Dmitriy Utsmiyev
Sample code below
@(Html.Kendo().Grid((IEnumerable<KendoUIMvcLoginApp.Models.Data.Printer>)ViewBag.Printers)
.Name("grid")
.Columns(columns =>
{
columns.Bound(e => e.PRINTER_NAME).Title("Printer Name");
columns.Bound(e => e.PRINTER_IP).Hidden();
columns.Bound(e => e.PRINTER_ID).Hidden();
columns.Bound(e => e.PRINTER_MIB_ID).Hidden();
columns.Command(command => command.Custom("Start").Click("showDetails")).Width(50);
})
.ClientDetailTemplateId("template")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HierarchyBinding_Employees", "Grid"))
)
.Events(events => events.DataBound("dataBound"))
)
<script id="template" type="text/x-kendo-template">
@(Html.Kendo().TabStrip()
.Name("tabStrip_#=PRINTER_ID#")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("Test Counters").Content(@<text>
@(Html.Kendo().Grid((IEnumerable<KendoUIMvcLoginApp.Models.Data.Counter>)ViewBag.Counters)
.Name("grid_#=PRINTER_ID#")
.Columns(columns =>
{
columns.Bound(o => o.COUNTER_NAME).Title("Name");
columns.Bound(o => o.COUNTER_VALUE).Title("Value");
columns.Bound(o => o.COUNTER_PRICE).Title("Price");
columns.Bound(o => o.COUNTER_PRICE_TOTAL).Title("Total Price");
columns.Bound(o => o.COUNTER_PRNITER_ID).Title("ID");
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=PRINTER_ID#" }))
.Filter(filter => filter.Add(prod => prod.COUNTER_PRNITER_ID).IsEqualTo(decimal.Parse("# =PRINTER_ID#")))
)
.Sortable()
.ToClientTemplate())
</text>
);
items.Add().Text("Printer Information").Content(
"<div class='employee-details'>" +
"<ul>" +
"<li><label>Printer:</label>#= PRINTER_NAME #</li>" +
"<li><label>Ip address:</label>#= PRINTER_IP #</li>" +
"<li><label>ID:</label>#= PRINTER_ID #</li>" +
"<li><label>MIB:</label>#= PRINTER_MIB_ID #</li>" +
"</ul>" +
"</div>"
);
})
.ToClientTemplate())
</script> <script>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</script>
<script>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</script>
<style scoped="scoped">
.k-detail-cell .k-tabstrip .k-content {
padding: 0.2em;
}
.employee-details ul
{
list-style:none;
font-style:italic;
margin: 15px;
padding: 0;
}
.employee-details ul li
{
margin: 0;
line-height: 1.7em;
} .employee-details label
{
display:inline-block;
width:90px;
padding-right: 10px;
text-align: right;
font-style:normal;
font-weight:bold;
}
</style>