随笔分类 - ASP.NET MVC
摘要:今天在ASP.NET MVC项目中,实现一个小功能,就是记录浏览者客户端的一些信息。比如浏览者的IP,访问了哪些页面,以及浏览器相关的信息。在数据库中创建一张表[VisitData]: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI
阅读全文
摘要:在Windows 2008 R2 Server中,网站无法播放MP4视频。我们需要在IIS的MIME type: 如果我们不想在IIS管理介面更改与设置,或是我们没有更多权限,这样我们可以项目的Web.config添加一个节点: <system.webServer> <staticContent>
阅读全文
摘要:需要要视图中Razor语法,循环产生一些html代码。产生后的html是这样的: <li data-transition="fade" data-slotamount="7" data-masterspeed="1500"> <img src="~/Content/img/slider-images
阅读全文
摘要:这个小功能,如果是算此次,已经是第5次修改了。可以从这里看到前4次:V1, http://www.cnblogs.com/insus/archive/2011/10/17/2215637.html V2, http://www.cnblogs.com/insus/archive/2011/10/18
阅读全文
摘要:有网友问及,怎样为html.EditorFor添加样式。解决方法,可以参考下面语法: 先new一个htmlAttributes。 @model Book @using Insus.NET.Models; @{ Layout = null; } <!DOCTYPE html> <html> <head
阅读全文
摘要:Linq的delegate表达式,Insus.NET觉得它封装得好,让开发时简化了很多代码,而且容易阅读与检索。 比如,我们需要计算优惠给客户金额,打85%折,可以这样写: using System; using System.Collections.Generic; using System.Li
阅读全文
摘要:今天学习,如标题。创建一个类,字段属性构造函数:Source code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Task
阅读全文
摘要:今天有做一个小功能,就是mouse经过主菜单之后,子菜单就永久显示,除非刷新了网页。先来看年实现的效果: Html代码: Source code: <div id="top"> <div id="top_1"> <ul> <li style="position:relative;"> <a href
阅读全文
摘要:数据源是一个DataTable,现在我们需要获取这个DataTable的第一行第一列的值。先准备一个数据集,创建一个DataTable,并填充数据: source code: using System; using System.Collections.Generic; using System.D
阅读全文
摘要:当你的数据库为SQLEXPRESS时,在程序的数据库连接字符串的服务Server使用127.0.0.1\SQLEXPRESS时,如下:它会显示一异常: Server Error in '/' Application. A network-related or instance-specific er
阅读全文
摘要:调试网站时,异常出现:Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. Server Error in '/' Application. Configuration Erro
阅读全文
摘要:Server Error in '/' Application. The system cannot find the file specified Description: An unhandled exception occurred during the execution of the cu
阅读全文
摘要:当你的ASP.NET MVC项跑在IIS时,出现如标题Handler "BlockViewHandler" has a bad module "ManagedPipelineHandler" in its module list异常时,可以尝试下面的解决方法,重新为IIS注册Framework。 6
阅读全文
摘要:部署一个ASP.NET MVC网站至一个全新的服务器Windows Server 2008 R2, 数据为MS SQL Server 2014 64bit Expression版本。运行时,它第一次显示出来是一个异常: The Web server is configured to not list
阅读全文
摘要:在开发ASP.NET MVC网站时,Insus.NET想实现动态产生网站的主菜单及子菜单。 你需要在网站管理后台管理此2张表(Menu,SubMenu)的信息,添加,删除,编辑,更新等。 Sequence字段是序号。主菜单按此序号排序。IsMenu字段,添加上来的,不一定是菜单字段。下面Insus.
阅读全文
摘要:学习LINQ的Lambda的表达式,尝试从数据集合中,选择其中几列。创建一个model: source code: namespace Insus.NET.Models { public class ProdImage { public int ProductID { get; set; } pub
阅读全文
摘要:在视图中,引用model,并绑定。有2种情况,一是数据集,另一个是单个model。实现之前,有准备一个数据吧。创建一个model:source code: namespace Insus.NET.Models { public class Book { public string Publishin
阅读全文
摘要:方法All返回布尔值bool,判断集合中是否所有元素都满足某一条件,通俗一点说,就是每一个元素,均符合同一个条件,它才返回真,不然返回假。举列,创建一个model: source code: namespace Insus.NET.Models { public class Book { publi
阅读全文
摘要:返回布尔值,判断集合中是否有元素满足某一条件。 source code: IEnumerable<string> str = new List<string> { "asdf","fgsdfg","tyuiu","ryury","ituyitu" }; if (str.Any(x => x.Ends
阅读全文
摘要:获取集合,需要使用多个条件Where,排序OrderBy,查询Select一起。先来分步实现: source code: string[] stringArray = { "hgdgh", "qerty", "Haktjjy", "zcvz", "rtwrt" }; var contains = E
阅读全文

浙公网安备 33010602011771号