如何将aspx引擎代码转换为剃刀引擎代码 [英] How to convert the aspx engine code to razor engine code

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

问题描述

您好任何人都可以建议我将以下aspx引擎视图更改为剃刀引擎视图。

在下面的代码中我有一个模型(CitiesViewModel)的复选框。我有一个在wcfservice中定义的Doctor类.......所以请将代码转换为razor引擎。



代码:



<< pre lang =xml>%using(Html.BeginForm()){%>

<%:Html .AntiForgeryToken()%>

<%:Html.ValidationSummary()%>

<%MvcCheckBoxList.Web.Mvc4.ViewModels.CitiesViewModel model = ViewData 。模型; %>

<%医生医生=新医生(); %>

< p class =" message-success"><%:( string)ViewBag.StatusMessage%>< / p>

< table style =" width:100%;" align =" left">

< tr style =" width:100%;">

< td style =" width:25 %;"><%:Html.LabelFor(m => doctor.CompanyCode)%>

<%:Html.TextBoxFor(m => doctor.CompanyCode)% >< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor.Dr_Name)%>

<%:Html.TextBoxFor(m => doctor.Dr_Name)%>< / td>

< td style =" width:25 %;"><%:Html.LabelFor(m => doctor.Dr_Add1)%>

<%:Html.TextBoxFor(m => doctor.Dr_Add1)% >< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor.Dr_Add2)%>

<%:Html.TextBoxFor(m => doctor.Dr_Add2)%>< / td>



< / tr>

< tr style =" width:100%;">



< td style =" width:25%;">< ;%:Html.LabelFor(m => doctor.Dr_City)%>

<%:Html.TextBoxFor(m => doctor.Dr_City)%>< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor.Dr_Pincode)%>

<%:Html.TextBoxFor(m = > doctor.Dr_Pincode)%>< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor.Dr_Phone)%>

<%:Html.TextBoxFor(m => doctor.Dr_Phone)%>< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor.Dr_Cell)%>

<%:Html.TextBoxFor(m = > doctor.Dr_Cell)%>< / td>



< / tr>

< tr style ="宽度:100%;">



< td style =" width:25%;"><%:Html.LabelFor(m => doctor.Dr_DOB)%>

<%:Html.TextBoxFor(m => doctor.Dr_DOB)%>< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor。 visitflag)%>

<%:Html.TextBoxFor(m => doctor.visitflag)%>< / td>

< td class = "" style =" width:50%;"><%= Html.CheckBoxListFor(m => model.PostedCities.CityIDs,

m => model.AvailableCities,

city => city.Id,

city => city.Name,

m => model.SelectedCities,

Position.Horizo​​ntal)%>< / td>



< / tr>



< tr style =" width:100%;">



< td style =" width:25%;">< %:Html.LabelFor(m => doctor.morningFR)%>

<%:Html.TextBoxFor(m => doctor.morningFR)%>< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor.morningTO)%>

<%:Html.TextBoxFor(m => doctor.morningTO)%>< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor.eveningFR)%>

<%:Html.TextBoxFor(m => doctor.eveningFR)%>< / td>

< td style =" width:25%;"><%:Html.LabelFor(m => doctor.eveningTO)%>

<%:Html.TextBoxFor(m = > doctor.eveningTO)%>< / td>



< / tr>

< / table>





< input type =" submit"值= [提交" />

<% - < / fieldset> - %>

<%= Html.ActionLink(" View Doctor"," ListDoctor")%>



<%}%

>

Hi Can anyone suggest me the idea to change the below aspx engine view to razor engine view.
In this below code i am having a model (CitiesViewModel) for checkbox . and i am having a Doctor class which is defined in wcfservice ....... so please convert the code to razor engine .

Code:

<<pre lang="xml">% using (Html.BeginForm()) { %>
<%: Html.AntiForgeryToken() %>
<%: Html.ValidationSummary() %>
<% MvcCheckBoxList.Web.Mvc4.ViewModels.CitiesViewModel model = ViewData.Model; %>
<% Doctor doctor = new Doctor(); %>
<p class="message-success"><%: (string)ViewBag.StatusMessage %></p>
<table style="width:100%;" align="left">
<tr style="width:100%;">
<td style="width:25%;"><%: Html.LabelFor(m => doctor.CompanyCode)%>
<%: Html.TextBoxFor(m => doctor.CompanyCode)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.Dr_Name)%>
<%: Html.TextBoxFor(m => doctor.Dr_Name)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.Dr_Add1)%>
<%: Html.TextBoxFor(m => doctor.Dr_Add1)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.Dr_Add2)%>
<%: Html.TextBoxFor(m => doctor.Dr_Add2)%></td>

</tr>
<tr style="width:100%;">

<td style="width:25%;"><%: Html.LabelFor(m => doctor.Dr_City)%>
<%: Html.TextBoxFor(m => doctor.Dr_City)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.Dr_Pincode)%>
<%: Html.TextBoxFor(m => doctor.Dr_Pincode)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.Dr_Phone)%>
<%: Html.TextBoxFor(m => doctor.Dr_Phone)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.Dr_Cell)%>
<%: Html.TextBoxFor(m => doctor.Dr_Cell)%></td>

</tr>
<tr style="width:100%;">

<td style="width:25%;"><%: Html.LabelFor(m => doctor.Dr_DOB)%>
<%: Html.TextBoxFor(m => doctor.Dr_DOB)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.visitflag)%>
<%: Html.TextBoxFor(m => doctor.visitflag)%></td>
<td class="" style="width:50%;"><%= Html.CheckBoxListFor(m => model.PostedCities.CityIDs,
m => model.AvailableCities,
city => city.Id,
city => city.Name,
m => model.SelectedCities,
Position.Horizontal)%></td>

</tr>

<tr style="width:100%;">

<td style="width:25%;"><%: Html.LabelFor(m => doctor.morningFR)%>
<%: Html.TextBoxFor(m => doctor.morningFR)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.morningTO)%>
<%: Html.TextBoxFor(m => doctor.morningTO)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.eveningFR)%>
<%: Html.TextBoxFor(m => doctor.eveningFR)%></td>
<td style="width:25%;"><%: Html.LabelFor(m => doctor.eveningTO)%>
<%: Html.TextBoxFor(m => doctor.eveningTO)%></td>

</tr>
</table>


<input type="submit" value="Submit" />
<%--</fieldset>--%>
<%= Html.ActionLink("View Doctor", "ListDoctor") %>

<% } %
>

推荐答案

检查这个



convert-mvc-2-aspx-into-mvc-4-razor-view-engine [ ^ ]


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

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