GridView的一个问题,请大家帮帮忙,在线等! 在gridview里面,如何显示有两种值的字段?比如:sk表里面paiming字段的值分别是0和1,当值是0的时候,button1显示,button2就显示为灰色;当值是1的时候,button2显示,button1就显示为灰色.在gridview里怎么做啊要? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { int i = 0; Button button1 = (Button)e.Row.FindControl("button1"); Button button2 = (Button)e.Row.FindControl("button2"); string value = e.Row.Cells[0].ToString(); if (button1 != null) { if (value == 0) { button1.Enabled = true; button2.Enabled = false; } else { button1.Enabled = false; button2.Enabled = true; } } } Click the link to solve your problem.Good luck! 按钮同时执行js和后台代码? 求一个动态加载的思路 一个简单又难答的问题,aspx页面显示的"默认绑定数目"条数如何设置? 为什么这样的代码执行错误? 20分的简单问题:未将对象引用设置到对象的实例 如何得到URL里面的全部信息? “客户编号”可以重复,怎么统计客户总数? 急问 asp.net2.0一个页面如何访问另一个页面上控件的值啊 郁闷---帮我解决数据库连接的问题,我是低手 |M| 幕白兄还是打印问题:如何点击“打印预览” 的时候窗口是最大化的,而不是现在的小窗口 关于TextBox
{
int i = 0;
Button button1 = (Button)e.Row.FindControl("button1");
Button button2 = (Button)e.Row.FindControl("button2");
string value = e.Row.Cells[0].ToString();
if (button1 != null)
{
if (value == 0)
{
button1.Enabled = true;
button2.Enabled = false;
}
else
{
button1.Enabled = false;
button2.Enabled = true;
}
}
}