转换剃刀的aspx在MVC3 [英] Convert razor to aspx in MVC3

查看:150
本文介绍了转换剃刀的aspx在MVC3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个剃刀文件Index.cshtml需要被转换为ASPX ......任何一个可以帮助我如何每一件事情申报类和模型.cshtml为.aspx

HI guys i have a razor file Index.cshtml which needs to be converted to aspx...can any one help me how to declare the classes and model every thing in .cshtml to .aspx

下面是我的 Index.cshtml code

Here is my Index.cshtml code

Index.cshtml

@model  IEnumerable<Gridview_BugTracker.Models.BugTracker_DataHelper>
@{
    ViewBag.Title = "Projects";
}          

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            ProjectName
        </th>
        <th>
            Description     
        </th>
        <th>
            Status
        </th>
    </tr>

    @foreach (var item in Model)
    {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.projectName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.status)
        </td>       
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.projectName }) |
            @Html.ActionLink("Details", "Details", new { id = item.Description }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.status })
        </td>
    </tr>
    }
</table>

请任何一个可以告诉我怎么写这个code在MVC3的ASPX

please can any one tell me how to write this code in aspx of MVC3

推荐答案

阿尼尔,

这窃听我,你发现这个这么难做到,我不得不回来给你如何自己动手做基础资料(授人以渔等.. :-))。无论如何,从顶部,做正常的东西了ASPX页面有,你的情况:

it bugged me that you found this so difficult to do that i had to come back and give you the base details on how to do it yourself (teach a man to fish etc.. :-)). anyway, from the top, do the NORMAL stuff that aspx pages have, in your case:

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" 
Inherits="System.Web.Mvc.ViewPage<IEnumerable<Gridview_BugTracker.Models.BugTracker_DataHelper>>" %>

好了,现在到样本块:

ok, now onto a sample block:

剃须刀:

@foreach (var item in Model)

ASPX:

<% foreach (var item in Model) { %>
    //... stuff 
    <%: Html.DisplayFor(modelItem => item.Description) %>
    // more stuff
    <%: Html.ActionLink("Edit", "Edit", new { id = item.projectName }) %> |
    <%: Html.ActionLink("Details", "Details", new { id = item.Description })%> |
<% } %>

正如你所看到的,纯粹的所需语法的变化应该不会超过5分钟,真的。

as you can see, purely syntax changes required that should take no more than 5 mins really.

祝你好运 - 让我知道它是如何锅了。

Good luck -let me know how it all pans out.

这篇关于转换剃刀的aspx在MVC3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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