使用Razor View Engine注册程序集 [英] Registering Assembly Using Razor view Engine

查看:45
本文介绍了使用Razor View Engine注册程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在aspx页面中有以下代码

Hi,
I have following code in aspx page

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CMg.Data.Donation>" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <form id="form1" runat="server">

    <rsweb:ReportViewer ID="rDonation"  runat="server" Font-Names="Verdana" 

    Font-Size="8pt" Height="467px" Width="888px">
        <LocalReport ReportPath="Content\Reports\Donation.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="Donation" />                
            </DataSources>            
        </LocalReport>        
    </rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1"  runat="server" SelectMethod="GetDonationCollection" TypeName="CMg.Data.DonationRepository">
<FilterParameters>
<asp:Parameter Name="FromDate" Type="DateTime" DefaultValue="12/26/2009"/>
</FilterParameters>
</asp:ObjectDataSource>
</form>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Scripts" runat="server">
</asp:Content>


我在Razor视图引擎中使用过它意味着我有.cshtml文件.问题是第一行代码,我不知道如何在开始时转换代码行


I have been using it in Razor view Engine mean I have .cshtml file Of it.The problem is the first Line of code I dont have idea that how to convert the code line at the start

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CMg.Data.Donation>" %>


剃刀视图.它是注册汇编文件的问题.有任何想法请告诉我

关于


to Razor view. Its the matter of registering assembling file.Have any Idea Please let me know

Regards

推荐答案

@{
    Layout = "~/_SiteLayout.cshtml";
    Page.Title = "Welcome to my Web Site!";
}




如果您将MVC与剃须刀一起使用,它足够智能,可以识别模型

如果Inherits ="System.Web.Mvc.ViewPage< cmg.data.donation>"是模型,则必须编写@model CMg.Data.Donation

使用Razor进行操作应该很容易




If you are using MVC with razor it is intelligent enough to Identify the model

If the Inherits="System.Web.Mvc.ViewPage<cmg.data.donation>" is the model then you have to write @model CMg.Data.Donation

It should be pretty easy to do stuff in with Razor


在代码的第一行中,您注册站点主站点(Razor View Engine中的布局),还应该插入一个页面应使用的模型.

而是将内容放入ASP视图引擎中,而应将@RenderSection放在版式中
In the first line of code you register site master(layout in Razor View Engine) and also you should insert a model that page should use.

Instead Content in ASP view engine you should put @RenderSection in Layout


这篇关于使用Razor View Engine注册程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆