asp.net mvc - Mvc 3 Razor : Using Sections for Partial View? -
i defined section in partial view , want specify content of section view. can't figure out way. in asp.net user controls, can define asp:placeholders, , specify content aspx user control lies. i'll glad suggestion.
thanks
[edit] here asp.net user control , want convert razor partial view
user control:
<%@ control language="c#" autoeventwireup="true" codefile="sprylistview.ascx.cs" inherits="sprylistview" %> <div spry:region="<%=this.sprydatasetname%>" id="region<%=this.id%>" style="overflow:auto;<%=this.divstyle%>" > <table class="searchlist" cellspacing="0" style="text-align:left" width="100%"> <thead> <tr> <asp:placeholder id="headercolumns" runat="server"></asp:placeholder> </tr> </thead> </table>
user control code:
public partial class sprylistview : system.web.ui.usercontrol { private string sprydatasetname ; private string nodatamessage = "aradığınız kriterlere uygun kayıt bulunamadı."; private bool callcreatepaging; private string divstyle; private itemplate headers = null; private itemplate body = null; [templatecontainer(typeof(genericcontainer))] [persistencemode(persistencemode.innerproperty)] public itemplate headertemplate { { return headers; } set { headers = value; } } [templatecontainer(typeof(genericcontainer))] [persistencemode(persistencemode.innerproperty)] public itemplate bodytemplate { { return body; } set { body = value; } } public string divstyle { { return divstyle; } set { divstyle= value; } } public string nodatamessage { { return nodatamessage; } set { nodatamessage = value; } } public string sprydatasetname { { return sprydatasetname; } set { sprydatasetname = value; } } public bool callcreatepaging { { return callcreatepaging; } set { callcreatepaging = value; } } void page_init() { if (headers != null) { genericcontainer container = new genericcontainer(); headers.instantiatein(container); headercolumns.controls.add(container); genericcontainer container2 = new genericcontainer(); body.instantiatein(container2); bodycolumns.controls.add(container2); } } public class genericcontainer : control, inamingcontainer { internal genericcontainer() { } } protected void page_load(object sender, eventargs e) { } }
aspx
<spry:listview sprydatasetname="dsorders" callcreatepaging="true" runat="server" id="orderlistview"> <headertemplate> <th> </th> <th>sİparİŞ tarİhİ</th> <th style="text-align:right">genel toplam</th> <th style="text-align:right">kdv</th> <th style="text-align:right">net toplam</th> </headertemplate> </spry:listview>
[edit]
i want in mvc 3 razor partial view.
templated razor delegates seem you're after. let helpers take template (your delegate) argument pass in view. way caller (your view) controls way information rendered, not helper, giving more flexibility.
Comments
Post a Comment