摘要:
一、前台脚本实现图片上传之前的预览效果@using (Html.BeginForm("SaveImg", "Test", FormMethod.Post, new { enctype = "multipart/form-data", id = "filefrm" }))@*一定要记得加enctype = "multipart/form-data"属性否则不能在后台获取到*@{value="上传" />}这里是预览图片这里是实现上传之后的图片@if (false){}$( 阅读全文
摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Web;namespace JPJC.Controllers{ /// /// 分页类 /// /// 集合 public class Page : List { /// /// 索引页 /// public int PageIndex { get; set; } /// /// 每页显示几条记录 /... 阅读全文
摘要:
在传统的webForms页面中,实现下拉列表三级联动甚至是8联动都是很简单的事情。可是在ASP.Net MVC中就不这么容易了。今天我就讲讲下拉三级联动,三级联动会了,那么8级9级也不在话下。先看看Linq to class看见了吧就是这三张表分别是公司,变电站,设备。ok我们看看视图好的,接下来我们看看代码的实现,先看后台控制器usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.Mvc;usingSystem.Web.Mvc.Ajax;usingMvcAppl 阅读全文
摘要:
1: ViewData传值方式ViewData的生命周期和View相同, 只对当前View有效.ViewData["zd"] = dfdfd2:TempData传值方式可以跨Action传递TempData的数据至多只能经过一次Controller传递, 并且每个元素至多只能被访问一次,例如一个用法为,抛出一个异常。跳转到error页面public ActionResult Index3(){TempData["tempIndex"] = "出错了!";Response.Redirect("/home/error" 阅读全文
摘要:
案例:item.Attributes.Add("UserID", this.TreeView1.SelectedNode.ToolTip.ToString());txtThem.Text= item.Attributes["UserID"].ToString(); 阅读全文
摘要:
/// 取得用户客户端IP(穿过代理服务器取远程用户真实IP地址)///public static string GetClientIP(){//如果使用代理,获取真实IPstring userip = string.Empty;if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != ""){userip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];}else{us 阅读全文
摘要:
序列化字符方法:注意这里的引用“System.Runtime.Serialization”和“System.ServiceModel.Web”using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Runtime.Serialization.Json;using System.ServiceModel.Web;///记得引用这个命名空间using System.IO;using System.Text;namespace BLL{//////序列化实体类///pu 阅读全文
只有注册用户登录后才能阅读该文。 阅读全文