Click here to Skip to main content
15,909,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have following code in aspx page
C#
<%@ 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>

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
ASP.NET
<%@ 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
Posted

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



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
 
Share this answer
 
v2
Comments
M Ali Qadir 11-Apr-12 0:12am    
I think Razor don't support for user controls such as register So in place of register what should I do?I already used a strongly typed View with Donation Model.
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
 
Share this answer
 
Comments
M Ali Qadir 11-Apr-12 0:06am    
Yes I have already put the @RenderSection in the Layout but I don't think this the solution to my question please be specific.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900