与一个column隐藏的GridView分页 [英] gridview paging with one colum hide

查看:58
本文介绍了与一个column隐藏的GridView分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中使用了gridview,在运行时我隐藏了一列
完成分页.

i used a gridview in my project where i hide one column at run time
and done paging.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  {
      e.Row.Cells[1].Visible = false;
  }



它告诉我错误



it show me the error

<br />
<pre lang="msil">Specified argument was out of the range of valid values.<br />
Parameter name: index<br />
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.<br />
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.<br />
Parameter name: index<br />
Source Error:<br />
Line 108:    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)<br />
Line 109:    {<br />
Line 110:        e.Row.Cells[1].Visible = false;<br />
Line 111:    }<br />
Line 112:}</pre><br />





我该怎么办?
请帮忙.





What will i do?
Please help.

推荐答案

您已经有2件了吗?

e.Row.Cells [0]?
e.Row.Cells [1]?

检查它,我想这是问题所在.
hi do you have 2 item already?

e.Row.Cells[0] ?
e.Row.Cells[1] ?

check it,i guess this is the problem..


您打算/为什么计划在RowDatabound 事件中隐藏?

RowDatabound是一个以行为基础处理网格的事件.
对于您来说,只需找到该列并将其隐藏即可.像这样的东西:
myDg.Columns[1].Visible = false;
How/Why do you plan to hide a column in a RowDatabound event?

RowDatabound is an event to handle grid at row basis.
For you, simple find the column and hide it. Something like:
myDg.Columns[1].Visible = false;


这篇关于与一个column隐藏的GridView分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆