- 浏览: 1005369 次
- 性别:
- 来自: 天津
文章分类
- 全部博客 (445)
- Java (22)
- J2EE (18)
- Flex (102)
- Flex-blazeds (1)
- Flex-FABridge (2)
- Flex4 (3)
- CheckStyle (2)
- PowerDesigner (0)
- POI (2)
- Java2Word (2)
- 杂项 (15)
- 日记 (3)
- 数据库-oracle (41)
- 数据库-SQLServer (7)
- 中间件 (1)
- 英语 (8)
- C# (43)
- ASP.net (72)
- ASP.net MVC (28)
- 微软-Entity Framework (19)
- JavaScript (22)
- JQuery (31)
- EasyUI (3)
- VS2010 (4)
- CVS (1)
- Tomcat (3)
- Linux (1)
- 遗留问题 (1)
- iphone (1)
- MAC (0)
- 系统 (2)
- Web Service (4)
- Cache Manager (1)
- PMP (1)
- WCF (10)
- BootstrapJs (1)
- Web API (6)
- Go语言 (0)
- 网络协议 (2)
- Redis (10)
- RabbitMQ (10)
- Git (3)
- Kafka (5)
- ELK (5)
- Nginx (3)
- 测试 (2)
最新评论
-
ygm0720:
Table行拖拽自己实现 -
程乐平:
Flex4开发视频教程(27集)下载http://bbs.it ...
Flex4教程 -
liuweihug:
Jquery+asp.net 后台数据传到前台js进行解析的办 ...
AJAX $.toJSON的用法或把数组转换成json类型 -
weilikk:
谢谢谢谢!!
javascript IE下不能用 trim函数解决方法 -
gxz1989611:
vigiles 写道请问楼主:[Fault] exceptio ...
blazeds推送技术至Flex
<%@ 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() { } // // GET: /SalesAdminLevel/ public ActionResult Index() { return View(); } public ActionResult GetSALevelList(int id) { List<SalesAdminLevelModel> saLevelList = SalesAdminLevelBL.GetSalesAdminLevelList(); SALevelListViewModel savm = new SALevelListViewModel(); savm.SelectID = id; savm.SALevelList = new List<SALevelListItemViewModel>(); if (saLevelList.Count > 0) { foreach (var item in saLevelList) { SALevelListItemViewModel salm = new SALevelListItemViewModel(); salm.intSalesAdminLevelID = item.intSalesAdminLevelID; string isActive = item.blnSalesAdminLevelActive ? "" : "(Inactive)"; salm.Text = (item.strSalesAdminLevelName + isActive).Trim(); if (salm.intSalesAdminLevelID == id) { salm.IsSelected = true; } else { salm.IsSelected = false; } savm.SALevelList.Add(salm); } } //ViewData["ViewEdit"] = GetViewEdit(); ViewBag.SalesAdminLevelID = id; return View("SalesAdminLevelListNew", savm); } /// <summary> /// Display Edit View /// </summary> /// <param name="model"></param> /// <returns></returns> [HttpPost] public ActionResult EditView(UserTypeListViewModel model) { //var session = SessionManager.Current; CurrentGroup = null; if (model.ViewEdit.Equals("1")) return RedirectToAction("Add", new { id = 0 }); if (model.ViewEdit.Equals("2")) return RedirectToAction("Edit", new { id = model.SelectID }); if (model.ViewEdit.Equals("3")) return RedirectToAction("Delete", new { id = model.SelectID }); if (model.ViewEdit.Equals("4")) return RedirectToAction("UpdateSalesAdminLevelActive", new { id = model.SelectID }); return View(); } #region GetViewEdit() public static SelectList GetViewEdit() { List<SelectListItem> item = new List<SelectListItem>(); item.Add(new SelectListItem { Text = Resources.SalesAdminLevel.Select, Value = "0" }); item.Add(new SelectListItem { Text = Resources.SalesAdminLevel.AddSALevel, Value = "1" }); item.Add(new SelectListItem { Text = Resources.SalesAdminLevel.EditeSALevel, Value = "2" }); item.Add(new SelectListItem { Text = Resources.SalesAdminLevel.DeleteSALevel, Value = "3" }); item.Add(new SelectListItem { Text = Resources.SalesAdminLevel.ActivateOrDeactivate, Value = "4" }); return new SelectList(item, "Value", "Text"); } #endregion GetViewEdit() // // GET: /SalesAdminLevel/Create [HttpPost] [ActionName("AddSetting")] public ActionResult Add(SALevelListViewModel model) { SalesAdminLevelViewModel salvm = new SalesAdminLevelViewModel(); return View(salvm); } // // POST: /SalesAdminLevel/Create [HttpPost] public ActionResult Add(SalesAdminLevelViewModel viewmodel) { try { SalesAdminLevelModel temp = new SalesAdminLevelModel(); temp.strSalesAdminLevelName = viewmodel.strSalesAdminLevelName; if (SalesAdminLevelBL.isSalesAdminLevelRepeat(temp)) { ModelState.AddModelError("sameSALevelName", Resources.SalesAdminLevel.sameSALevelName); throw new Exception(); } else { viewmodel.blnSalesAdminLevelActive = true; SalesAdminLevelModel temputm = SalesAdminLevelBL.SaveSalesAdminLevel(viewmodel.ToSalesAdminLevelModel()); } return RedirectToAction("Index"); } catch { return View(viewmodel); } } // // GET: /SalesAdminLevel/Edit/5 [HttpPost] public ActionResult Edit1(SALevelListViewModel model) { return RedirectToAction("Edit", new { id = model.SelectID }); } // // GET: /SalesAdminLevel/Edit/5 public ActionResult Edit(int id) { SalesAdminLevelModel utm = new SalesAdminLevelModel(); utm.intSalesAdminLevelID = id; utm = SalesAdminLevelBL.GetSalesAdminLevelInfo(utm); SalesAdminLevelViewModel utViewModel = new SalesAdminLevelViewModel(utm); ViewBag.SALevelID = id; return View(utViewModel); } // // POST: /SalesAdminLevel/Edit/5 [HttpPost] public ActionResult Edit(int id, SalesAdminLevelViewModel utvm) { try { SalesAdminLevelModel temp1 = new SalesAdminLevelModel(); temp1.strSalesAdminLevelName = utvm.strSalesAdminLevelName; temp1.intSalesAdminLevelID = id; ViewBag.SALevelID = id; if (SalesAdminLevelBL.isSalesAdminLevelRepeat(temp1)) { ModelState.AddModelError("sameSALevelName", Resources.SalesAdminLevel.sameSALevelName); temp1 = null; throw new Exception(); } else { utvm.intSalesAdminLevelID = id; SalesAdminLevelModel temputm = SalesAdminLevelBL.UpdateSalesAdminLevel(utvm.ToSalesAdminLevelModel()); } return RedirectToAction("index"); } catch (Exception ex) { SalesAdminLevelModel userTypeModelexp = utvm.ToSalesAdminLevelModel(); return View(new SalesAdminLevelViewModel(userTypeModelexp)); } } // // GET: /SalesAdminLevel/Delete/5 public ActionResult Delete(int id) { SalesAdminLevelModel utm = new SalesAdminLevelModel(); utm.intSalesAdminLevelID = id; //utm = SalesAdminLevelBL.GetSalesAdminLevelByid(utm); if (utm != null) { SalesAdminLevelBL.DeleteSalesAdminLevel(utm); } return RedirectToAction("Index"); } // // POST: /SalesAdminLevel/Delete/5 [HttpPost] public ActionResult Delete(int id, SALevelListViewModel utvm) { try { SalesAdminLevelModel temp = new SalesAdminLevelModel(); temp.intSalesAdminLevelID = utvm.SelectID; if (temp != null) { SalesAdminLevelBL.DeleteSalesAdminLevel(temp); } return RedirectToAction("Index"); } catch { return View(utvm); } } public ActionResult UpdateSalesAdminLevelActive(int id) { SalesAdminLevelViewModel utm = new SalesAdminLevelViewModel(); utm.intSalesAdminLevelID = id; SalesAdminLevelBL.UpdateSalesAdminLevelActive(utm.ToSalesAdminLevelModel()); return RedirectToAction("index"); } } }
发表评论
-
asp.net mvc处理css和js版本问题
2018-05-24 16:40 1330当服务的修改了js和css内容后,发布到II ... -
分布式系统调用链监控
2018-02-22 14:36 827分布式系统调用链监 ... -
使用C# 和Consul进行分布式系统协调
2017-05-11 10:41 1247随着大数据时代的到来,分布式是解决大数据问题的一个主要手段, ... -
权限控制
2016-06-16 11:09 761权限控制就是分为“用户登录身份验证”、“控制器方法权限控制” ... -
[ASP.NET MVC ]13 - Helper Method
2016-06-15 13:44 571我们平时编程写一些辅助类的时候习惯用“XxxHelper”来 ... -
[ASP.NET MVC]14 - Unobtrusive Ajax
2016-06-15 12:46 631Ajax (Asynchronous JavaScript ... -
[ASP.NET MVC ]08 - Area 使用
2016-06-15 12:28 730ASP.NET MVC允许使用 Area(区域)来组织Web ... -
将ASP.NET MVC中的form提交改为ajax提交
2016-06-01 15:51 2407在ASP.NET MVC视图中通过 @using (Htm ... -
@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction区别
2016-06-01 14:02 997ASP.NET MVC 中@Html.Partial,@Ht ... -
Fiddler 模拟http form提交
2016-04-19 10:01 1607以下为代码部分 下面是fiddler调用此form ... -
MVC3 验证码
2011-11-07 14:30 1552MVC3开发,看附件 -
MVC 分页 JQuery Pager
2011-11-07 13:00 3153导入的包 <script type=" ... -
ASP.NET MVC - Creating a SelectListItem with the disabled="disabled" attribute
2011-10-24 15:07 1451要完成这样的效果 <option disabled=& ... -
希望大家告诉我一些关于.net MVC3 MVC2的书籍
2011-10-21 16:36 1449大家好,小弟进入微软时间不久,正在学习微软的MVC3,但是基本 ... -
Jquery与.net MVC结合,通过Ajax
2011-10-14 09:55 2604在工作中做了这么一个东西。 Html端: @using T ... -
Radio Button and CheckBox在FireFox中刷新自动改变选中项
2011-08-29 12:54 2751今天开发过程中出现了这样一个问题,我选中radio butto ... -
jQuery Supertextarea Plugin
2011-08-18 11:46 1242http://truthanduntruth.com/deve ... -
详解ASP.NET MVC中DropDownList的使用
2011-07-27 17:27 2207本文我们将讲解DropDownList的使用,这在ASP.NE ... -
ASP.NET MVC 学习: 视图
2011-07-07 16:24 1807用视图呈现UI 视图可以不包含任何应用逻辑或者数据库 ... -
MVC 各种传值方式
2011-07-07 15:41 5324【转自】:http://hi.baidu.com/honfei ...
相关推荐
asp.net mvc admin user control release dates
ASP.NET MVC Tabbed Menu Control.Source Code. http://www.dev102.com/2009/04/14/creating-a-tabbed-menu-control-for-aspnet-mvc/
AspMvc是一个快速、简单的面向对象的轻量级Asp开发框架,是为了简化企业级应用开发和敏捷WEB应用开发而诞生的。 借鉴了国内外很多优秀的(Java Ssh/Net NetMvc3.5 ThinkPhp)框架和模式,使用面向对象的开发结构和MVC...
"Learning ASP.NET Core MVC Programming" English | ISBN: 1786463830 | 2016 | EPUB | 342 pages | 17 MB Key Features Get a first-principles coverage of ASP.NET MVC and the latest release, Core This book...
ASP.NET MVC 2.0 lets you test drive your code, control the output of your HTML, and leverage C# and .NET in an easy-to-use web framework. This book shows you all you need to know to get started ...
非常好用的ASP.NET MVC控件,提供大量实用的的页面技术 访问地址 http://awesome.codeplex.com/ 具体请参考范例 下载官网代码,然后替换此文件中的dll,就可以不受限制的使用了
ASP.NET MVC 与Using Entity Framework结合的例子 可以参看下
In this book, world-renowned ASP.NET expert and member of the Microsoft ASP.NET team Stephen Walther shows experienced developers how to use Microsoft's new ASP.NET MVC Framework to build web ...
Microsoft's brand new ASP.NET MVC Framework now offers a fully-supported way for developers to implement MVC architectures in ASP.NET applications. ASP.NET MVC in Action is a comprehensive guide to ...
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. ASP...
but if it had to be said it in a quick sentence: "ASP.NET MVC is ASP.NET Unplugged." ASP.NET MVC is a tinkerer's framework that gives you very fine-grained control over your HTML and Javascript,...
but if it had to be said it in a quick sentence: "ASP.NET MVC is ASP.NET Unplugged." ASP.NET MVC is a tinkerer's framework that gives you very fine-grained control over your HTML and Javascript,...
but if it had to be said it in a quick sentence: "ASP.NET MVC is ASP.NET Unplugged." ASP.NET MVC is a tinkerer's framework that gives you very fine-grained control over your HTML and Javascript,...
but if it had to be said it in a quick sentence: "ASP.NET MVC is ASP.NET Unplugged." ASP.NET MVC is a tinkerer's framework that gives you very fine-grained control over your HTML and Javascript,...
but if it had to be said it in a quick sentence: "ASP.NET MVC is ASP.NET Unplugged." ASP.NET MVC is a tinkerer's framework that gives you very fine-grained control over your HTML and Javascript,...
介绍后台管理登录功能,主要包括: 验证输入基本信息(登录名、密码长度) 登陆成功之后可以获取用户基本信息,并跳转到主界面 未登陆用户不可进入主界面 退出登录
Programming Microsoft ASP.NET MVC 592 pages Publisher: Microsoft Press; 1 edition (May 14, 2010) Language: English ISBN-10: 0735627142 ISBN-13: 978-0735627147 Delve into the features, ...
MVC详细图解 MVC详细图解 一目了然 看了就明白了 model view control