日期:2014-05-17 浏览次数:20953 次
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<com.nowdocs.nowsource.Admin.ViewModels.SiteConfiguration.SALevelListViewModel>" %> <script type='text/javascript'> $(function () { $('li').click(function () { $('#SelectID').val($(this).children(':input').val()); $('ul li').removeClass("selected"); $(this).addClass("selected"); }); //方法一 $('#btn_del').click(function (e) { var sid = $('#SelectID').val(); if (sid != null && sid != '' && sid != '0') { e.preventDefault(); location.href = '<%= Url.Action("Delete","SalesAdminLevelNew")%>' + '/' + sid; //location.href = 'Delete/' + sid; } else $(this).val("0"); }); $('#btn_activate').click(function (e) { var sid = $('#SelectID').val(); if (sid != null && sid != '' && sid != '0') { e.preventDefault(); location.href = '<%= Url.Action("UpdateSalesAdminLevelActive","SalesAdminLevelNew")%>' + '/' + sid; //location.href = 'Delete/' + sid;方法二注掉了,有时候URL会拼写错误,不建议使用 } else $(this).val("0"); }); }); </script> <div id="group-list" class="admin-panel" style="width: 400px;"> <div class="title"> <%: com.nowdocs.nowsource.Admin.Resources.SalesAdminLevel.SALevelTitle %> </div> <div class="content"> <div class="wrap" id="ChildGroupList" style="display: block;"> <ul> <% if (Model.SALevelList != null) { foreach (var link in Model.SALevelList) { if (link.IsSelected) {%> <li class="selected"> <%} else { %> <li> <%} %> <a> <%: link.Text%></a><%: Html.Hidden("SalesAdminLevelID", link.intSalesAdminLevelID)%></li> <% } }%> </ul> </div> <div class="viewedit"> <%: Html.Hidden("SelectID")%> <!--方法三--> <input type="submit" id="btn_add" value="Add" onclick='this.form.action="<%= Url.Action("AddSetting") %>";' /> <!--方法四--> <input type="submit" id="btn_edit" value="Edit" onclick='this.form.action="<%= Url.Action("Edit1") %>";' /> <input type="button" id="btn_del" value="Delete" /> <input type="button" id="btn_activate" value="Activate/Deactivate" /> </div> </div> </div>
?Control.cs
using System; using System.Collections.Generic; using System.Web.Mvc; using com.nowdocs.nowsource.Admin.BusinessLogic.SiteConfiguration; using com.nowdocs.nowsource.Admin.ViewModels.SiteConfiguration; using com.nowdocs.nowsource.common; using com.nowdocs.nowsource.Models; using log4net; namespace com.nowdocs.nowsource.Admin.Controllers.SiteConfiguration { public class SalesAdminLevelNewController : AdminController { protected static readonly ILog logger = LogManager.GetLogger("SalesAdminLevelController"); public GroupModel CurrentGroup { get { return StateManager.CurrentGroup; } set { StateManager.CurrentGroup = value; } } public SalesAdminLevelNewController() : base() { }