随笔分类 -  Asp.net MVC

摘要:然后打开web程序,访问ip:port/Help. 为什么可以直接输入Help就能访问呢,因为这个插件本身已经配置了路径,如下。 阅读全文
posted @ 2018-08-22 15:34 liu_xh 阅读(708) 评论(0) 推荐(0)
摘要:function fun($){…};fun(jQuery);这种方法多用于存放开发的插件,执行其中的代码时,Dom对象并不一定加载完毕。 $(function(){})等价于$(document).ready(function(){});,这种方法在使用时页面的Dom对象已经加载完毕了。 阅读全文
posted @ 2018-02-24 15:12 liu_xh 阅读(321) 评论(0) 推荐(0)
摘要:TrimToDBCModelBinder.cs 然后在mvc项目的global.asax.cs下的Application_Start()加入 这样,就可以对string、int、long、double类型起作用了。 阅读全文
posted @ 2018-02-11 09:08 liu_xh 阅读(253) 评论(0) 推荐(0)
摘要:1 public class MyPager 2 { 3 /// 4 /// 每一页数据的条数 5 /// 6 public int PageSize { get; set; } 7 8 /// 9 /// 总数据条数 10 /// 11 ... 阅读全文
posted @ 2018-02-06 16:32 liu_xh 阅读(310) 评论(0) 推荐(0)
摘要:怎么将Session记录到数据库中呢? 其实微软已经为我们设置好了。只要我们简单的配置一下就行了。 当然也要在 “我的电脑” 鼠标右键 >管理 >服务和应用程序 > 服务 >ASP.NET状态服务(或者ASP.NET State Service) >点击右键选择“启动” 首先。我们进入C盘下的 Wi 阅读全文
posted @ 2018-02-05 22:29 liu_xh 阅读(260) 评论(0) 推荐(0)
摘要:ASP.NET 项目运行时出现错误提示:[HttpException (0x80004005): 无法连接到 SQL Server 会话数据库。] ,后排查问题发现是由于项目的Session模式是使用SQLServer,(即Session信息保存在SQL Server的数据库中)但是与数据库的SQL 阅读全文
posted @ 2018-02-05 22:02 liu_xh 阅读(2565) 评论(0) 推荐(0)
摘要:一对多(两种配置方法): 第一种: 1、把“一端”作为“多端”的导航属性。同时在“多端”增加一个“一端”类型id属性。 2、在“多端”的config做配置。 第二种: 1、在“多端”配“一端”类型的导航属性,同时在“多端”增加一个“一端”id属性。 2、在“一端”配置“多端”泛型类的集合导航属性。 阅读全文
posted @ 2018-01-17 13:30 liu_xh 阅读(574) 评论(0) 推荐(0)
摘要:$('#modal的id').modal('show'); 阅读全文
posted @ 2017-12-15 00:45 liu_xh 阅读(1481) 评论(0) 推荐(0)
摘要:使用先前的数据上下文,可以通过使用LINQ查询,按字母顺序检索出所有专辑,代码如下 阅读全文
posted @ 2017-11-28 14:11 liu_xh 阅读(953) 评论(0) 推荐(0)
摘要:<body> <div id="main-content">@RenderBody()</div> <footer>@RenderSection("Footer")</footer> </body> 引用上述模版的时候, <p>this is the main Content</p> @sectio 阅读全文
posted @ 2017-11-28 11:47 liu_xh 阅读(119) 评论(0) 推荐(0)
摘要:通常访问视图的时候,都会去选择访问Views文件夹内对应于Controller同名的文件夹下的某一个视图,这个视图对应于这个Controller类的某一个方法。 其实,也可以让这个方法对应于不同名的cshtml文件。 例如: HomeController类中有一个方法Index(),通常return 阅读全文
posted @ 2017-11-28 10:55 liu_xh 阅读(284) 评论(0) 推荐(0)
摘要:把静态页面放到@Url.Content();中,如href="@Url.Content("a.html")" 阅读全文
posted @ 2017-11-17 10:24 liu_xh 阅读(1967) 评论(0) 推荐(0)