随笔分类 -  GridView

摘要:1、你写一个方法,到页面上: StrLength 这个方法就是处理字符串的,写到cs文件中。 protected string StrLength (string str) { if (str.Length > 10) { return str.Substring(0, 10) + "..."; } else { return str; } } GridView 中用模板列... 阅读全文
posted @ 2009-09-04 13:44 Hayden Han 阅读(273) 评论(0) 推荐(0)
摘要:ViewState["OutPut"] = "";//定义一个变量用于存储查询条件/// <summary> /// 新建一个新的Gridview用于导出 /// </summary> /// <param name="where">导出条件</param> private GridView OutPutBinder(string where) { ... 阅读全文
posted @ 2009-07-10 16:11 Hayden Han 阅读(243) 评论(0) 推荐(0)
摘要:先导入命名空间using System.Text;//用于使用StringBuilder 方法protected static string GetNumPwd(int num)//生成数字随机数 { string a = "0123456789"; StringBuilder sb = new StringBuilder(); for(int i = 0; i < num; i++) { ... 阅读全文
posted @ 2009-07-09 17:36 Hayden Han 阅读(424) 评论(0) 推荐(0)
摘要:在gridview按钮中添加模板列: <asp:TemplateField HeaderText="操作"> <ItemTemplate> <asp:Button ID="btnValid" runat="server" OnClick="btnValid_Click" CommandArgument='<%# Eval("Id") %>' Text="激... 阅读全文
posted @ 2009-07-09 16:34 Hayden Han 阅读(337) 评论(0) 推荐(0)
摘要:在数据库中的字段为cardState,它的值为0或1,但绑定到gridview时需要显示已激活或为激活,不显示0或1.方法一:SQL语句方法select * ,cardstatename=(case cardstate when 0 then '否' when 1 then '是' end) from tblcard查询时新建一列,在页面绑定时直接绑定cardstatename即可。方法二:页面显... 阅读全文
posted @ 2009-07-09 11:26 Hayden Han 阅读(695) 评论(0) 推荐(0)