This is a migrated thread and some comments may be shown as answers.

[Solved] why cant I use @item here?

0 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
william
Top achievements
Rank 1
william asked on 21 Dec 2011, 10:13 AM
My grid :
@(Html.Telerik().Grid(Model.Sections)
                    .Name("policyZoneGrid")
                    .DataKeys(keys => keys.Add(r => r.SectionID))
                        .Groupable(grouping => grouping.Groups(groups =>
                        {
                            groups.Add(r => r.UIDisplayName);
                        }))
                .ToolBar(toolbar => toolbar.Template(@<text>
                    <button id="addSection" type="submit">Add Section</button><span> </span>
                    @Html.DropDownListFor(x => x.SectionTypeSelectedId, new SelectList(Model.SectionTypes, "Value", "Text"))
                 </text>))
                    .Columns(columns =>
                    {
                        columns.Template(
                            @<text>
                                 @Html.ActionLink("Edit", "Edit", @item.ControllerName, new { sectionID = @item.SectionID, policyZoneID = Model.PolicyZoneID }, null)
                                 <a class='deleteSection' href='#' sectionid=@item.SectionID url=@item.ControllerName >Delete</a>
                            </text>).Width(40).Title("Commands");
                            columns.Bound(r => r.Name).Title("Name").Width(200);
                            columns.Bound(r => r.UIDisplayName).Title("Section").Width(200);
                            columns.Bound(r => r.Gross).Title("Gross").Width(150).Format("{0:0.00}").HtmlAttributes(new { style = "text-align:right" });
                    })
 
                    .Sortable(sorting => sorting.OrderBy(sortOrder => sortOrder.Add(o => o.UIOrder).Descending()))
                    .Pageable()
                    .RowAction(row =>
                    {
                        if (row.IsAlternate) { row.HtmlAttributes["style"] = "background:aliceblue;"; }
                    })
works fine to this point.
Now, because I want to display a slightly different view when a record is expanded, based on the type I'm trying to inject the detailview.
when I add the following to the above code:
.DetailView(detailview => detailview.ClientTemplate("<div id='section_'" + @item.  + ">Loading risk summary data<img src='/Content/bar-circle.gif' /></div>"))
                    .ClientEvents(events => events.OnDetailViewExpand("displaySectionDataByType"))
I cannot use @item here, but it's ok above in the columns. HOw then can I obtain the current items sectionID etc to inject into my <div> tag. If I can do this then my problem is solved.
Tags
Grid
Asked by
william
Top achievements
Rank 1
Share this question
or