2012年8月27日
摘要: 阅读全文
posted @ 2012-08-27 13:10 一直在前进 阅读(100) 评论(0) 推荐(0) 编辑
2011年10月12日
摘要: function PrintPage(){var newstr = document.getElementById("printContent").innerHTML;var oldstr = document.body.innerHTML;document.body.innerHTML = newstr;window.print();document.body.innerHTML = oldstr;return false; } 阅读全文
posted @ 2011-10-12 14:44 一直在前进 阅读(563) 评论(0) 推荐(0) 编辑
2011年10月5日
摘要: IE的编码和ff,chrome都不同,ajax提交数据乱码,尤其是中文,解决方法其实很简单首先,保持utf-8编码和post提交数据是必要的。其次将参数用escape编码再发送。比如xxx.aspx?u=escape(username) 阅读全文
posted @ 2011-10-05 17:38 一直在前进 阅读(280) 评论(0) 推荐(0) 编辑
2011年9月21日
摘要: 一般DAL层都会涉及到往表里添加和修改数据,根据Model设置SqlParameter[],以及将datarow数据转化为Model,利用泛型和反射,可以大大简化代码。首先是DalHelper类public static class DalHelper<T> where T : new() { #region SqlParameter /// <summary> /// 通过Model类获取属性的SqlParameter数组 /// </summary> /// <param name="classObject">Model类 阅读全文
posted @ 2011-09-21 17:05 一直在前进 阅读(861) 评论(4) 推荐(1) 编辑
2011年8月2日
摘要: using System;using System.Text;using System.Text.RegularExpressions;//这个一定要加 namespace EC {/// <summary>/// 替换字符串/// </summary>public class StringRepStrs { public StringRepStrs () {} #region 普通替换字符串 /// <summary>/// 普通替换字符串 /// </summary>/// <param name="src"> 阅读全文
posted @ 2011-08-02 14:34 一直在前进 阅读(676) 评论(0) 推荐(0) 编辑
2011年7月18日
摘要: 创建cookievar cookie = new HttpCookie("member");cookie.Values.Add("memberName", name);cookie.Values.Add("memberType", type.ToString());cookie.Expires = DateTime.Now.AddDays(30);Response.Cookies.Add(cookie);读Cookievar cookie = Request.Cookies["member"];if (cookie 阅读全文
posted @ 2011-07-18 11:29 一直在前进 阅读(240) 评论(0) 推荐(0) 编辑
2011年6月29日
摘要: 需引用 System.Net.Mail;public void SendEmail(string from,string to,string subject, string body) { MailMessage message = new MailMessage(from,to); message.Subject = subject; message.IsBodyHtml = true; message.Body = body; SmtpClient client = new SmtpClient("smtp.163.com"); client.Credentials = 阅读全文
posted @ 2011-06-29 11:45 一直在前进 阅读(149) 评论(0) 推荐(0) 编辑
2011年6月21日
摘要: [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple = true) // multiuse attribute]public class Author : System.Attribute{ string name; public double version; public Author(string name) { this.name = name; version = 1.0; // Default value } public strin 阅读全文
posted @ 2011-06-21 12:33 一直在前进 阅读(231) 评论(0) 推荐(0) 编辑
2011年6月20日
摘要: using System;using System.IO;using System.Text;using System.Windows.Forms;using System.IO.Compression;using System.Collections.Generic; namespace CompressionSample{ class ZipUtil { public void CompressFile(string iFile, string oFile) { //判断文件是否存在 if (File.Exists(iFile) == false) { throw new FileNotF 阅读全文
posted @ 2011-06-20 12:00 一直在前进 阅读(802) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 解析URL(可以正确识别UTF-8和GB2312编码) /// </summary> /// <param name="uriString"></param> /// <returns></returns> public static string DecodeURL(String uriString) { //正则1:^(?:[\x00-\x7f]|[\xe0-\xef][\x80-\xbf]{2})+$ //正则2:^(?:[\x00-\x7f]|[\xfc-\x 阅读全文
posted @ 2011-06-20 11:57 一直在前进 阅读(735) 评论(0) 推荐(0) 编辑