zoukankan      html  css  js  c++  java
  • ASP.NET MVC 3.0小知识积累

    1、JsonResult

     1 using System.Web.Mvc;
    2
    3 //public ActionResult Index()
    4 public JsonResult Index()
    5 {
    6 var province = from p in new Models.NorthwindDataContext().Province
    7 select p;
    8
    9 return Json(new
    10 {
    11 page = 1,
    12 total = province.Count(),
    13 rows = province.ToList()
    14 },
    15 JsonRequestBehavior.AllowGet
    16 );
    17 }

    2、Html Helper

    @Html.TextBox("UserName")    <—>    <input id="UserName" type="text" value="" name="UserName">

    @Html.TextBox("UserName", null, new { id = "txtUserName" })    <—>    <input id="txtUserName" type="text" value="" name="UserName">
    @Html.TextBox("UserName", null, new { id = "txtUserName", style = "100px;" })    <—>    <input id="txtUserName" type="text" value="" style="100px;" name="UserName">

    @Html.TextBox("UserName", null, new { id = "txtUserName", @class = "highlight" })    <—>    <input id="txtUserName" class="highlight" type="text" value="" name="UserName">

    @Html.ActionLink("删除", "DeletePost", new { id = item.ID }, new { onclick = "return confirm('你确定要删除该随笔?')" })

  • 相关阅读:
    form表单提交target属性使用
    window.showModalDialog
    mybaits中date类型显示时分秒(orcle数据库)
    mybatis中in查询
    偷懒的inline-block解决方法
    10. python单元测试(一)
    9. Request & 爬虫
    8. 类与对象
    7. python异常处理&异常基类学习
    6. IO及文件操作
  • 原文地址:https://www.cnblogs.com/libingql/p/2435378.html
Copyright © 2011-2022 走看看