用javascript操纵GridView中CheckBox的两个常用技巧
2010-09-14 13:16:59 来源:WEB开发网CheckBox.aspx.cs
还是用来生成测试数据的,不然前面的GridView里没东西,就没得折腾了
using system;
using system.Data;
public partial class CheckBox:System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//生成DataTable并添加相应的列
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Author");
dt.Columns.Add("Title");
dt.Columns.Add("PostTime");
dt.Columns.Add("URL");
//测试数据填充
dt.Rows.Add(1, "丁学", "用javascript/css实现GridView行背景色交替、点击行变色", "*************",
"**********************************************************************");
dt.Rows.Add(1, "丁学", "突发奇想--有关微软未来", "2008-05-11 09:59",
"http://www.cnblogs.com/dingxue/archive/2008/05/11/1191936.html");
dt.Rows.Add(2, "丁学", "可爱的google翻译,笑死我了", "2008-05-11 09:07 ",
"http://www.cnblogs.com/dingxue/archive/2008/05/11/1191900.html");
dt.Rows.Add(3, "丁学", "模板修改后重新发布", "2008-04-26 07:22",
"http://www.cnblogs.com/dingxue/archive/2008/04/26/1171778.html");
dt.Rows.Add(4, "丁学", "想买啥 VS 买了啥!理想与现实的差距咋就这么大咧?", "2008-04-13 07:39",
"http://www.cnblogs.com/dingxue/archive/2008/04/13/1150952.html");
dt.Rows.Add(5, "丁学", "XHTML/CSS记忆力大测试,两项都超过我,我请你吃饭!", "2008-04-03 06:40",
"http://www.cnblogs.com/dingxue/archive/2008/04/03/xhtml_css_test.html");
dt.Rows.Add(6, "丁学", "Designer VS Coder, who is the winner?", "2008-03-26 07:44",
"http://www.cnblogs.com/dingxue/archive/2008/03/26/coder_vs_designer.html");
dt.Rows.Add(7, "丁学", "用DIV模拟弹出窗口--窗体滚动跟随--丁学", "2007-09-03 08:42",
"http://www.cnblogs.com/dingxue/archive/2007/09/03/879654.html");
dt.Rows.Add(8, "丁学", "一个简单但常用的表格样式--鼠标划过行变色--简洁实现", "2007-08-09 07:12",
"http://www.cnblogs.com/dingxue/archive/2007/08/09/848555.html");
dt.Rows.Add(9, "丁学", "关于IE7关闭窗口时总是提示和上传图片前的本地预览解决办法", "2007-06-19 08:50",
"http://www.cnblogs.com/dingxue/archive/2007/06/19/788449.html");
dt.Rows.Add(10, "丁学", "IE对input元素onchange事件的支持BUG", "2007-03-23 07:54",
"http://www.cnblogs.com/dingxue/archive/2007/03/23/684807.html");
dt.Rows.Add(11, "丁学", "由验证控件引起的IE的超级爆笑BUG", "2007-03-22 07:35",
"http://www.cnblogs.com/dingxue/archive/2007/03/22/683401.html");
dt.Rows.Add(12, "丁学", "DIV中滚动条设置到随机位置(CSS+Javascript)", "2007-03-18 12:17",
"http://www.cnblogs.com/dingxue/archive/2007/03/18/678839.html");
dt.Rows.Add(13, "丁学", "ASP.NET AJAX1.0尝鲜试用:Web Service调用", "2007-03-17 17:36",
"http://www.cnblogs.com/dingxue/archive/2007/03/17/678383.html");
dt.Rows.Add(14, "丁学", "ASP.NET中利用利用Skin引入CSS的问题", "2007-03-17 17:30",
"http://www.cnblogs.com/dingxue/archive/2007/03/17/678374.html");
//将DataTable绑定到GridView
gvMeiMingZi.DataSource = dt;
gvMeiMingZi.DataBind();
}
}
原文:http://www.cnblogs.com/dingxue/archive/2008/05/19/1202305.html
Tags:javascript 操纵 GridView
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接