排球计分程序中英文切换

---恢复内容开始---

排球计分程序中英文切换功能

主要思路是制作两套页面,一套中文的,一套英文的。

根据用户点击 中文 English 完成相应的中英文切换 

根据这一设想 我增加了视图和Action。

视图的截图如下

Action的截图如下:

 

内部代码基本相同 只是将所需的页面文字改为英文。

示例代码如下

 

@{
    ViewBag.Title = "Index";
}


<html>
    <head>
        <title>Enter Your Name</title>
    </head>
    <body>
        @Html.ActionLink("中文", "Index")
        @Html.ActionLink("English", "EIndex")
        @using(Html.BeginForm("EAddPerson","Home")) { 
            <table border="1">
                <tr>
                    <th>@Html.Label("a","initial of team:")</th>
                <th colspan="1">@Html.TextBox("teamAName")</th>
  
                <th>VS</th>
                    <th>@Html.Label("b","initial of team:")</th>
                <th colspan="1">@Html.TextBox("teamBName")</th>
                   </tr>
                <tr>
                <th>team member</th>
                <th>Full name</th>
                <th></th>
                <th>team member</th>
                <th>Full name</th>
                   </tr>
                @{
            for (int i = 1; i <=12; i++)
            {
                <tr>
                    <td>@Html.TextBox("idA"+i.ToString(),i)</td>
                    <td> @Html.TextBox("nameA"+i.ToString())</td>
                    <td></td>
                    <td> @Html.TextBox("idB"+i.ToString(),i)</td>
                    <td> @Html.TextBox("nameB"+i.ToString())</td>
                </tr>
            }
                
                }
            </table>
<button type="submit">submit</button>
}
    </body>
    </html>
英文 视图
@{
    ViewBag.Title = "Index";
}


<html>
    <head>
        <title>输入姓名</title>
    </head>
    <body>
        @Html.ActionLink("中文", "Index")
        @Html.ActionLink("English", "EIndex")
        @using(Html.BeginForm("AddPerson","Home")) { 
            <table border="1">
                <tr>
                    <th>@Html.Label("a","队名:")</th>
                <th colspan="1">@Html.TextBox("teamAName")</th>
  
                <th>VS</th>
                    <th>@Html.Label("b","队名:")</th>
                <th colspan="1">@Html.TextBox("teamBName")</th>
                   </tr>
                <tr>
                <th>队员</th>
                <th>姓名</th>
                <th></th>
                <th>队员</th>
                <th>姓名</th>
                   </tr>
                @{
            for (int i = 1; i <=12; i++)
            {
                <tr>
                    <td>@Html.TextBox("idA"+i.ToString(),i)</td>
                    <td> @Html.TextBox("nameA"+i.ToString())</td>
                    <td></td>
                    <td> @Html.TextBox("idB"+i.ToString(),i)</td>
                    <td> @Html.TextBox("nameB"+i.ToString())</td>
                </tr>
            }
                
                }
            </table>
<button type="submit">提交</button>
}
    </body>
    </html>
中文视图
  public ActionResult Index()
        {
            return View();
        }
中文 Action
  public ActionResult EIndex()
        {
            return View();
        }
英文Action

用于中英文切换的代码

 @Html.ActionLink("中文", "Index") 
@Html.ActionLink(
"English", "EIndex")

 

其余代码基本不变 由此可以实现中英文的切换

 

运行时截图如下

到此演示完毕,

 

 

---恢复内容结束---

posted on 2017-09-10 10:50 adminyu 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/zyadmin/p/7500435.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值