摘要: 这是今天写的代码,问题是:我在弹出层中添加的服务器按钮事件,在弹出层不触发?View Code 运行调试时候,BtnAdd的服务器端事件不会触发。。 网上查看资料后,才发现,原来是弹出层在被Jquery创建open后跳出了表单form1,所有无法执行服务器端事件。 解决方法有: 1、设置按钮 不被解析成 submit,UseSubmitBehavior="false" 2、使用js延时,在按钮提交关闭弹出层,后才提交表单 dialog.close(); setTimeout(function () { $("#form1").subm... 阅读全文
posted @ 2012-11-20 15:33 hello*boy 阅读(1595) 评论(3) 推荐(0) 编辑
摘要: 通过Javascript实现无刷新分页,把后台得到的数据以Table的形式显示出来,获取第index页的数据是通过异步请求得到的。不过这里创建显示数据的Table我是用拼接字符串的,然后innerHTML赋值的。 效果图:1、后台获取数据通过一般处理程序获取get请求中的index页,然后查询数据。View Code 1 <%@ WebHandler Language="C#" Class="GetPage" %> 2 3 using System; 4 using System.Web; 5 using System.Collections 阅读全文
posted @ 2012-10-27 16:34 hello*boy 阅读(4791) 评论(8) 推荐(3) 编辑
摘要: 在此,网站图片防盗链的方法是,通过获取Http请求头中的 Referer 标头与本网站域名比较,来判断用户是否来自本站跳转过来的创建一个全局处理程序,用来处理images目录下的图片的直接请求View Code 1 using System; 2 using System.Web; 3 4 /// 5 ///DaoLian 的摘要说明 6 /// 7 public class DaoLian:IHttpHandler 8 { 9 public bool IsReusable10 {11 get { return false; }12 }13 14... 阅读全文
posted @ 2012-08-17 21:54 hello*boy 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 当直接请求网站中images目录下的.jpg图片时把图片加上水印,然后输出1、在web.config中设置一个全局应用程序来处理该目录下的请求 <System.Web> <httpHandlers> <add verb="*" path="images/*.jpg" type="WaterMarker">2、创建一个处理水印的类,对应type中的WaterMarkerView Code 1 using System; 2 using System.Web; 3 using System.Drawin 阅读全文
posted @ 2012-08-16 20:20 hello*boy 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 在显示页面使用表单POST传送数据 <form action="TestUpload.ashx" method="post" enctype="multipart/form-data"> <input type="file" name="fUplod" /><input type="submit" value="上传" /> <span id="msgUpload"></span&g 阅读全文
posted @ 2012-08-16 19:25 hello*boy 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 1、邮件发送1.1、设置要发送的邮件对象 MailMessage mes=new MailMessage(); //发件人 mes.From=new MailAddress("caoyi@qq.com"); //收件人 mes.To.Add("hui@qq.com"); //标题 mes.Subject="标题"; //内容 mes.Body="内容"; //附件 mes.Attachments.Add(new Attachment(@"d:\aa.txt"));1.2、设置发送邮件服务器 设置 阅读全文
posted @ 2012-08-04 21:53 hello*boy 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 安装:CHSPinYinConv,导入CHSPinYinConv.dll,引入空间using Microsoft.International.Converters.PinYinConverter;View Code 1 //汉字转拼音 2 static string GetPinYin(string strCHS) 3 { 4 char[] myChar = strCHS.ToCharArray(); 5 string strOK = ""; 6 //遍历转换 7 ... 阅读全文
posted @ 2012-08-01 22:45 hello*boy 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 一、父选择窗口二、子窗口提供选择FrmSelectAreas1、数据准备: 在数据库中有一张表Areas字段为:AID,AName,APid; AID为字段地区编号,AName为地区名称,APid为地区父级AID.2、FrmSelectAreas窗体中,递归遍历绑定数据 View Code 1 void BindParent() //绑定父节点 2 { 3 //添加父节点 4 TreeNode parent = new TreeNode(); 5 parent.Text = "全国"; 6 ... 阅读全文
posted @ 2012-07-31 23:27 hello*boy 阅读(472) 评论(0) 推荐(0) 编辑
摘要: 1、在MDI主窗体中先要设置其属性:isMdiContainer=true; 2、在要实现单例模式(也就是,一次只能打开一个该窗口)的窗体对象中,添加一个私有字段和属性, 为了保证不能通过new Form1()方式创建窗体,所以还要保证 其构造函数私有化。 private static FrmClass instance; //静态字段 public static FrmClass Instance //提供外部访问的属性 { get { //未创建对象,或释放了该窗体。 if(instance==null && inst... 阅读全文
posted @ 2012-07-30 22:17 hello*boy 阅读(558) 评论(0) 推荐(0) 编辑
摘要: 哈哈,以前看到别人网站上面的漂浮广告觉得很神奇,应该要很复杂的代码吧。 但是,现在学了javascript后,自己想着做了一个,不过做完自己的后看了一下别人写的,参考一下,改进一些。 现在OK! ………(^_^)<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xht 阅读全文
posted @ 2012-07-29 21:45 hello*boy 阅读(353) 评论(0) 推荐(0) 编辑