This question is locked. New answers and comments are not allowed.
Hi,
I am new to telerik MVC ....
I have a view that does a render partialview .....
The partial view for the above looks like this....
The controller that runs them both looks like this ....
I am new to telerik MVC ....
I have a view that does a render partialview .....
| <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Work.Master"%> |
| <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> |
| <div> |
| <h1>MemberNo: <%=ViewData["vdMemberNo"]%></h1> |
| <h1>Body Composition Analysis for : <%= TempData["vdDisplayName"]%></h1> |
| </div> |
| </asp:Content> |
| <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> |
| <p> |
| Telerik GRID Data ..... |
| </p> |
| <table> |
| <tr> |
| <td align="center" style="width:800px;" > |
| <% Html.RenderPartial("MemberGrid", Model); %> |
| </td> |
| </tr> |
| </table> |
| </asp:content> |
The partial view for the above looks like this....
| <%@ Control Language="C#" |
| Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<MBSAnalysisMVC.Models.Members>>" %> |
| <% Html.Telerik().Grid(Model) |
| .Name("MemberGrid") |
| .Columns(columns => |
| { |
| columns.Add(o => o.MemberNo).Width(10); |
| columns.Add(o => o.Username).Width(150); |
| columns.Add(o => o.FirstName).Width(150); |
| columns.Add(o => o.DateCreated).Format("{0:MM/dd/yyyy}").Width(120); |
| columns.Add(c => { |
| %> |
| <%= Html.ActionLink("Edit", "Edit", new { id = c.MemberNo }, |
| new { @class="t-link action-edit" })%> |
| <%= Html.ActionLink("Delete", "Delete", new { id = c.MemberNo }, |
| new { @class = "t-link action-delete" }) %> |
| <% |
| }).Title("Actions").Width(150); |
| }) |
| // .Ajax() // Needs additional information. |
| .Scrollable() // Will throw off position, needs to be further configured. |
| .Filterable() |
| //.Pageable() |
| .Sortable() |
| .Render(); |
| %> |
| <style type="text/css"> |
| .action-edit { background-image: url('<%= ResolveUrl("~/Content/Images/Icons/edit.png") %>'); } |
| .action-delete { background-image: url('<%= ResolveUrl("~/Content/Images/Icons/delete.png") %>'); } |
| .action-edit, .action-delete |
| {padding-left: 18px; |
| background-repeat: no-repeat; |
| background-position: 0 50%; |
| margin-right: 10px;} |
| .action-edit:hover, |
| .action-delete:hover |
| {text-decoration: none;} |
| </style> |
| <p> |
| <%= Html.ActionLink("Create New", "Create") %> |
| </p> |
The controller that runs them both looks like this ....
| public ActionResult Management() |
| { |
| ViewData["iqMemberNo"] = TempData["vdMemberNo"].ToString(); |
| ViewData["orientation"] = "Horizontal"; // "Vertical"; |
| MBSAnalysisMVCEntities _dataModel = new MBSAnalysisMVCEntities(); |
| return View(_dataModel.Members.ToList()); |
| // return View();// displays the paritalview, but it is empty. |
| } |
How can I just call the view from my controller like this .....
return View();
Not really sure of the most effecient way for this Partial View to read the "Members" Model and populate its Telerik Grid ? Is it a FOR loop that I need in the Parital View ? If so, is there documentation someplace that tells me how to populate the columns and rows ?
All of the telerik examples I have seen, populate the views by passing data from the controller ?
Thanks for your time.