随笔分类 -  ASP.NET

防盗链IHttpHandler(转自垃圾猪)
摘要:1/**//* 2 * 3 * 防盗链IHttpHandler 4 * 5 * 6 * 增加了对文件关键字的选择(即仅对文件名存在某些关键字或不存在某些关键字进行过滤) 7 * 设置web.config中节以下值 8 * string eWebapp_NoLink 如果文件名符合该正确表态式将进行过滤(不设置对所有进行过滤) 9 * string eWebapp_Al... 阅读全文
posted @ 2005-12-19 17:41 .net技術 阅读(239) 评论(0) 推荐(0)
按比例显示图片大小
摘要:ShowImage.aspx显示页面DataList模板项html: ' Runat="server"> ' AlternateText=''> 图片处理页面GetThumbnail.aspx代码: const int MaxLength=150; //显示图片最大长度 private void Page_Load(o... 阅读全文
posted @ 2005-11-16 15:23 .net技術 阅读(814) 评论(0) 推荐(0)
回车改变焦点
摘要:另外一种: 阅读全文
posted @ 2005-11-16 14:56 .net技術 阅读(291) 评论(0) 推荐(0)
ASP.NET中实现模版的动态加载
摘要:ASP.NET中,经常会使用到templates(模版)功能,比如在datagrid,datalist,repeater等控件中,使用templates,将会大大增强其功能。以往,我们一般是在设计程序时,就已经设置好控件中的模版是怎样的了。但是,有的时候,可能我们需要动态加载模版,比如,当你要求你的应用程序的界面风格随着用户的需求而变化时,你就需要到动态加载模版的功能了。但要注意的是,并不是所有的... 阅读全文
posted @ 2005-11-02 23:11 .net技術 阅读(207) 评论(0) 推荐(0)
用存储过程自定义分页
摘要://通过user_id返回留言集合 public ArrayList GetCommentboardsByUidPage(int user_id,int pagenumber) { IDbCommand m_Command = DataAccess.GetCommand(); m_Command.CommandType = CommandType.StoredProcedure;... 阅读全文
posted @ 2005-10-10 09:57 .net技術 阅读(259) 评论(0) 推荐(0)
上传图片及显示图片
摘要:string pathstr="\\temp\\temp1"; string dr=Server.MapPath(pathstr); if(!Directory.Exists(dr)) //沒有目錄就創建目錄 Directory.CreateDirectory(dr); string fname=Path.GetFileName(File1.PostedFile... 阅读全文
posted @ 2005-09-18 17:33 .net技術 阅读(347) 评论(0) 推荐(0)
适用各种文件下载的方法
摘要:private void backup_Click(object sender, System.EventArgs e) { string filename=System.DateTime.Now.ToShortDateString()+".mdb"; //为下载文件设默认名; string fullpath=Server.MapPath("../data/jc... 阅读全文
posted @ 2005-07-19 17:04 .net技術 阅读(392) 评论(0) 推荐(0)
检查某字段是否为空值
摘要://C#public User PopulateUser(IDataRecord dr) {User user = new User();user.UserId = Convert.ToInt32(dr["UserId"]);//检查 NULL 的示例if (dr["UserName"] != DBNull.Value){user.UserName = Convert.ToString(dr["U... 阅读全文
posted @ 2005-07-18 21:24 .net技術 阅读(227) 评论(0) 推荐(0)
文件上传
摘要:加引用using System.IO;string dr=Server.MapPath(".\\Files"); if(!Directory.Exists(dr)) Directory.CreateDirectory(dr); string fname=Path.GetFileName(File1.PostedFile.FileName); string fullname=dr+"... 阅读全文
posted @ 2005-07-18 00:23 .net技術 阅读(274) 评论(0) 推荐(0)
datagrid删除确认对话框
摘要:datagrid-》属性生成器-》列-》添加按钮列-》删除-》文本(T)->在文本框里加上:删除 阅读全文
posted @ 2005-07-16 21:31 .net技術 阅读(198) 评论(0) 推荐(0)
[转]DataGrid与DropDownList
摘要:有的时候我们需要(1)在编辑的时候用下拉框选择,并且默认为数据库的内容(2)使用下拉框过滤数据(3)使用css统一定制DataGrid下面给出代码:数据结构:表dep:depid(标识主键),depname(学院名字)表stu:stuid(标识主键),stuname(学生名字),studepid(学院id=表dep.depid)前台: WebForm28 ... 阅读全文
posted @ 2005-07-15 21:36 .net技術 阅读(396) 评论(0) 推荐(0)
好站好文滙集
摘要:台湾的好网站http://www.blueshop.com.tw/ (论坛答疑点滴)如何在用户控件内得到包含这个用户控件的页面中的控件的值http://www.cnblogs.com/lovecherry/archive/2005/04/11/135543.html (论坛答疑点滴)如何得知调用当前方法的方法名?http://www.cnblogs.com/lovecherry/archive/2... 阅读全文
posted @ 2005-07-14 14:23 .net技術 阅读(623) 评论(0) 推荐(0)