随笔分类 -  ASP.NET

修改Visual Studio的默认模板
摘要:如果我在Visual Studio创建的项目中每次新建一个文件,自动生成注释或者是结构的话,那么就需要改下默认的模板了。下面以vs2013为例我们添加的文件有很多种,这里就举例3种,CSharp类文件,Web项目下的类文件,cshtml文件1.CSharp类文件(.class文件)1.1模板位置:C... 阅读全文

posted @ 2016-01-21 13:18 Paste 阅读(4840) 评论(0) 推荐(0) 编辑

C#剪切生成高质量缩放图片
摘要:/// /// 高质量缩放图片 /// /// 源图的路径 /// 存储缩略图的路径 /// 缩放后图片宽度 /// 缩放后图片高度 /// 表明此次操作是否成功 public sta... 阅读全文

posted @ 2014-12-29 11:13 Paste 阅读(364) 评论(0) 推荐(0) 编辑

excel导出显示默认格子
摘要: 阅读全文

posted @ 2014-12-16 16:24 Paste 阅读(333) 评论(0) 推荐(0) 编辑

Repeater 嵌套
摘要:<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound"> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%#Eval("QuestionName") %>'></asp:Label> <asp:Label I 阅读全文

posted @ 2011-07-27 17:28 Paste 阅读(178) 评论(0) 推荐(0) 编辑

GridView添加行号
摘要:<asp:TemplateField HeaderText="序号"><ItemTemplate> <%# Container.DataItemIndex+1 %> </ItemTemplate></asp:TemplateField> 阅读全文

posted @ 2011-06-22 14:19 Paste 阅读(113) 评论(0) 推荐(0) 编辑

给按钮在后台添加属性
摘要:this.Button1.Attributes.Add("onclick","javascript:if(confirm('继续吗?');"){return true;}else{return false;}"); 阅读全文

posted @ 2011-05-19 14:10 Paste 阅读(166) 评论(0) 推荐(0) 编辑

关闭页面不弹出提示框
摘要:--关闭页面不弹出提示框Response.Write("<script>alert('您无权操作!');window.opener=null;window.open('','_self');window.close();</script>");--点击alert确定后 跳转页面Response.Write("<script>alert('该名已经存在!');window.location.href='WebForm2.aspx'</script 阅读全文

posted @ 2011-05-19 14:06 Paste 阅读(181) 评论(0) 推荐(0) 编辑

获取IP
摘要:public static string GetIP() { string result = String.Empty; result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (null == result || result == String.Empty) { result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } if (null == result || 阅读全文

posted @ 2011-05-19 14:05 Paste 阅读(187) 评论(0) 推荐(0) 编辑

C# 上传下载文件
摘要:代码 阅读全文

posted @ 2010-10-29 18:17 Paste 阅读(172) 评论(0) 推荐(0) 编辑

ASP.Net
摘要:1.获取页面名字string pageName = System.IO.Path.GetFileName(HttpContext.Current.Request.Path); 2.弹出提示框Page.ClientScript.RegisterStartupScript(this.GetType(), "message", "<script>alert('提示消息')</script>");3.继承了母版页的子页面调用js代码子页面js代码引用写成...<script language="javasc 阅读全文

posted @ 2010-10-25 16:09 Paste 阅读(139) 评论(0) 推荐(0) 编辑

ashx生成验证码
摘要:using System.Web.SessionState; //用到sessionpublic class Validate : IHttpHandler,IRequiresSessionState //为要使用session实现的接口{ public void ProcessRequest (HttpContext context) { string checkCode = GetVali... 阅读全文

posted @ 2010-10-18 15:36 Paste 阅读(3053) 评论(0) 推荐(0) 编辑

关于vs连接access
摘要:第一:连接字符串首先在web.config文件配置(Access2003和2007都一样)<connectionStrings><add name='DBPath' connectionString='~/App_Data/Web.mdb'/><!--数据库路径,前面的~必须保留--></connectionStrings>第二:连接字符串Acces... 阅读全文

posted @ 2010-10-18 15:18 Paste 阅读(1794) 评论(0) 推荐(0) 编辑

导航

点击右上角即可分享
微信分享提示