摘要: View Code 1 /// <summary> 2 /// 判断两个数组是否相等(顺序必须相同) 3 /// </summary> 4 /// <param name="a">数据A</param> 5 /// <param name="b">数据B</param> 6 /// <returns></returns> 7 public static bool ArrayIsEqual(String[] a, String[] b) 8 { 9 if (a 阅读全文
posted @ 2012-01-29 09:55 名字随意 阅读(468) 评论(0) 推荐(0) 编辑
摘要: public string GetPopedAction(int PopedAction) { string str = ""; if (PopedAction == 0) { str += "无需特殊处理,"; } if ((PopedAction & 1) == 1) { str += "已删除,"; } if ((PopedAction &... 阅读全文
posted @ 2013-12-25 15:41 名字随意 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Repeater和DataGrid相比,repeater集成了较少的功能,高可定制化,repeater在客户端生成的html代码是非常干净的。但正是由于Repeater的简单,给我们带来了一定的开发难度。比如在datagrid中要删除一行数据,那么仅仅是一个linkbutton,然后在datagrid的delete command事件中编写删除代码,但是在repeater中,你几乎没有办法在那个事件中定位是哪行触发的删除事件。方法一、通过URL来传递参数后台代码protected void btnDelete_Click(object sender, CommandEventArgs e){ 阅读全文
posted @ 2012-01-31 09:50 名字随意 阅读(371) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #region 将字符串转换为数组 2 public static string[] GetStrArray(string str) 3 { 4 return str.Split(new char[',']); 5 } 6 #endregion 7 8 #region 将数组转换为字符串 9 public static string GetArrayStr(List<string> list, string speater)... 阅读全文
posted @ 2012-01-29 14:27 名字随意 阅读(187) 评论(0) 推荐(1) 编辑
摘要: View Code 1 /// <summary> 2 /// 字符串是否为空 3 /// </summary> 4 /// <param name="str"></param> 5 /// <returns></returns> 6 public static bool IsNullOrEmpty(this string str) 7 { 8 return str == null || str == string.Empty || str == ""; 9 } 10 11 /// 阅读全文
posted @ 2012-01-29 14:26 名字随意 阅读(144) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 防注入 3 /// </summary> 4 /// <param name="content">提交的内容</param> 5 /// <returns></returns> 6 public static string PreventScriptIncludeSQL(this string content) 7 { 8 int i = 0; 9 string sqlchar = "insertinto|deletefrom|a 阅读全文
posted @ 2012-01-29 14:25 名字随意 阅读(200) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 对象转化为字符串 3 /// </summary> 4 /// <param name="obj">对象</param> 5 /// <param name="defaultValue">默认值</param> 6 /// <returns></returns> 7 public static string GetString(this object obj) 8 { 9 return obj.T 阅读全文
posted @ 2012-01-29 14:23 名字随意 阅读(156) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 将DataRow读取到的一行 转为 Model 3 /// </summary> 4 /// <param name="dr">DataRow</param> 5 /// <returns>泛型实体</returns> 6 public static T ToModel(DataRow dr) 7 { 8 // 获得此模型的类型 9 Type type = typeof(T);10 string tempName = "" 阅读全文
posted @ 2012-01-29 14:22 名字随意 阅读(228) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 将 SqlDataReader 转为Model, 如果 SqlDataReader.read() 有值 ,返回对象,否则返回Null 3 /// </summary> 4 /// <param name="dr">SqlDataReader</param> 5 /// <returns>泛型实体</returns> 6 public static T ToModel(SqlDataReader dr) 7 { 8 // 获得此模型的类型 9 阅读全文
posted @ 2012-01-29 14:22 名字随意 阅读(269) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 将SqlDataReader读取的内容转为Model,结束后不会自动关闭Reader 3 /// </summary> 4 /// <param name="dr">SqlDataReader</param> 5 /// <returns>泛型实体集合</returns> 6 public static IList<T> ToModels(SqlDataReader dr) 7 { 8 IList<T> ts = n 阅读全文
posted @ 2012-01-29 14:21 名字随意 阅读(165) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /// <summary> 2 /// 将DataTable转为Model 3 /// </summary> 4 /// <param name="dt">DataTable</param> 5 /// <returns>泛型实体集合</returns> 6 public static IList<T> ToModels(DataTable dt) 7 { 8 IList<T> ts = new List<T>(); 9 // 获得此模型的类型 阅读全文
posted @ 2012-01-29 14:20 名字随意 阅读(184) 评论(0) 推荐(0) 编辑