zoukankan      html  css  js  c++  java
  • 表单与JQuery

    表单:
    Html标签注意:
    1.提交action
    2.提交按钮:类型一定为type="submit" ,不然无反应
    3.
    Jquery: 个人认为属于JS
    1.一般不用表单提交
    2.直接onClick提交给JS中的Jquery,在由Jquery提交给后台并接收Json返回值
    =====================================================================================================
    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ViewMasterPageAdmin.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
    <%@ Import Namespace="CMSLYF.Models.Entity" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
         Index
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="LYF_all">
       <img src="../../Content/Image/lyf_siteMapPath.gif" />
        <asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath>
        <fieldset id="content_fieldset" style="border:1px solid yellow">           
            <h2>SiteSetting_Index</h2>
            <table>
                <tr style="background-color:#ff6a00;">
                    <th>Name</th>
                    <th>Value</th>
                    <th>操作</th>
                </tr>
                <%foreach(SiteSettingsEntity sse in Model){ %>
                <tr>
                    <th><%=sse.Name %></th>
                    <th><%=sse.Value %></th>
                    <th><a href="javascript:FunShowSiteSetting(<%=sse.SiteSettingId %>)">修改</a>|</th>
                </tr>
                <tr style="background-color:yellow">
                    <th></th>
                    <th></th>
                    <th></th>
                </tr>
                <%} %>
            </table>
          <form action="/SiteSetting/Index" method="post">
            网站设置信息:<br />
            名称:<input type="text" id="Name" name="Name" /><br />
            值  :<input type="text" id="Value" name="Value" /><br />
            <input type="submit" id="ButtonSave" name="" value="保存修改" hidden="hidden" />
            <input type="button" id="ButtonAddSet" name="" value="添加" />
          </form>
     </fieldset>
    </div>
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderStyle" runat="server">
        <script src="../../Scripts/jquery-1.8.2.js"></script>
        <script type="text/javascript">
            function FunShowSiteSetting(id) {
                $.post("/SiteSetting/SelectSiteSettingById/" + id, function (data) {
                    $("#Name").val(data.Name);
                    $("#Value").val(data.Value);
                    $("#ButtonAddSet").hide();
                    $("#ButtonSave").show();
                });
                
            }
        </script>
    </asp:Content>
  • 相关阅读:
    【转】大型高性能ASP.NET系统架构设计
    【原创】构建高性能ASP.NET站点 第五章—性能调优综述(后篇)
    表关联键上创建索引的重要性
    NorthScale Memcached Server尝试总结
    转:80后的80条幽默有哲理的语录
    利用AOP重构代码
    Sandcastle Help File Builder
    酒店项目OO设计
    泛型委托在项目中的应用
    SQL CTE能帮助我做什么
  • 原文地址:https://www.cnblogs.com/blogLYF/p/5653971.html
Copyright © 2011-2022 走看看