单击链接按钮时如何隐藏gridview中的行? [英] How to hide a row in gridview while clicking link button?
本文介绍了单击链接按钮时如何隐藏gridview中的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if(e.CommandName ==Delete)
{
int index = Convert.ToInt32(e.CommandArgument);
GridView1.Rows [index] .Visible = false;
}
我写了这个。但它显示输入字符串不在格式正确。而不是将行位置存储到索引。
解决方案
错误有两种可能的原因: -
1.在下面的代码中检查 e.CommandArgument 是否返回Integerint index = Convert.ToInt32(e.CommandArgument);
2.检查提供的索引是否不小于0 否定GridView1.Rows [index] .Visible = false;
首先检查你是否得到e.CommandArgument一个整数。
还有一件事就是删除一行,使用GridView1.DeleteRow(index);
if (e.CommandName == "Delete")
{
int index = Convert.ToInt32(e.CommandArgument);
GridView1.Rows[index].Visible = false;
}
I wrote this.But it's showing "Input string was not in a correct format." instead of storing row position to index.
解决方案
There are 2 possible reason for the error :-
1. In The Below Code check if e.CommandArgument returns Integerint index = Convert.ToInt32(e.CommandArgument);
2. Check if the index supplied is not less than 0 or not negativeGridView1.Rows[index].Visible = false;
first check whether you are getting e.CommandArgument an integer or not.
one more thing is for deleting a row, use GridView1.DeleteRow(index);
这篇关于单击链接按钮时如何隐藏gridview中的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文