Button控制GridView 请教各位大侠,我想通过一个Button点击事件来隐藏GridView中的某一列,这样可以实现吗?注:Button不是嵌在GridView中,而是独立在外的一般Button。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 找到那个列,设置其visible属性 Button_OnClick:遍历 GridView.Rows,设置 GridView.Rows[i].Cells[j].Visible=false; 也可以采用js进行处理。tabel1.rows[i].cells[j].style.display="none" Button 点击事件GridView1.Cells[第几列].Visable=false; string SqlDelStr = "delete from useradmin where userid=" + this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();SelectedRows表示的是在DataGridView中所选择的行,其中Count属性是表示的选择的行数CurrentRow表示的就是所选择的当前行,只有一行dataGridView1.Rows[dataGridView1.CurrentRow.Index ].Cells["id"].Value.ToString() ; 还是不行,下面是我的代码,新手,求救protected void Button1_Click(object sender, EventArgs e) { gvView.Cells[5].Visable = false; BindData(); }错误 22 “System.Web.UI.WebControls.GridView”不包含“Cells”的定义,并且找不到可接受类型为“System.Web.UI.WebControls.GridView”的第一个参数的扩展方法“Cells”(是否缺少 using 指令或程序集引用?) this.GridView1.Columns[0].Visible = false;protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { for (int i = 1; i <= 7; i++) { this.GridView1.Rows[i].Columns["列名"].Visible = false; } } 数组元素比较问题?? 初来乍到,希望论坛的各位前辈以后多多关照 使用repositoryItemLookUpEdit遇到问题 关于Datetimepicker的问题 如何在事件中激发另一个事件? 散分的四个问题,上网找了两天的资料未能解决,寻求各位帮助,谢谢,在线等…… C#后台删除图片文件 C#初学问题 WIN7 FTP服务器的问题 关于使用ProgressBar的问题 请教一个分组算法 求教Winform 解析一个Json 结果放到DataTable里
tabel1.rows[i].cells[j].style.display="none"
CurrentRow表示的就是所选择的当前行,只有一行
dataGridView1.Rows[dataGridView1.CurrentRow.Index ].Cells["id"].Value.ToString() ;
还是不行,下面是我的代码,新手,求救protected void Button1_Click(object sender, EventArgs e)
{
gvView.Cells[5].Visable = false;
BindData();
}错误 22 “System.Web.UI.WebControls.GridView”不包含“Cells”的定义,并且找不到可接受类型为“System.Web.UI.WebControls.GridView”的第一个参数的扩展方法“Cells”(是否缺少 using 指令或程序集引用?)
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
for (int i = 1; i <= 7; i++)
{
this.GridView1.Rows[i].Columns["列名"].Visible = false;
}
}