显示和隐藏网格视图选定的行特定单元格
目前我正在做一个项目。
网格中共有 5 列,其中 2 列可见 false。
name email_id_X email_id mobile_no_X mobile_no SELECT -------------------------------------------------- --------------------------------- Mahesh maXXXXXXahoo.co.in [email protected] 98XXXXXX96 986769696 SELECT Kiran kiXXXXXX.in [email protected] 93XXXXXX333 9333333333 SELECT Kiran kiXXXXXX.in [email protected] 93XXXXXX333 9333333333 SELECT Kiran kiXXXXXX.in [email protected] 93XXXXXX333 9333333333 SELECT Amit AmXXXXXXin [email protected] 93XXXXXX333 9333333333 SELECT
所以请告诉我如何隐藏 email_id 和 mobile_no 列。 当用户单击选择时,他只能看到选定的行 email_id 和 mobile_no。
谢谢。
Currently I'm working on one project.
There are total 5 columns in grid in which 2 are visible false.
name email_id_X email_id mobile_no_X mobile_no SELECT -------------------------------------------------- --------------------------------- Mahesh maXXXXXXahoo.co.in [email protected] 98XXXXXX96 986769696 SELECT Kiran kiXXXXXX.in [email protected] 93XXXXXX333 9333333333 SELECT Kiran kiXXXXXX.in [email protected] 93XXXXXX333 9333333333 SELECT Kiran kiXXXXXX.in [email protected] 93XXXXXX333 9333333333 SELECT Amit AmXXXXXXin [email protected] 93XXXXXX333 9333333333 SELECT
So please tell me how to hide the column email_id and mobile_no.
and when user click on select that time he can only see the selected rows email_id and mobile_no.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先为这两列设置
visible=false
。然后,要仅获取您选择的行,请更改 datasourceid 并在
gridview1_SelectedIndexchanged
事件中绑定数据。首先,对数据源的查询类似于
Select * from table1
。当您第二次绑定时,当您单击选择时,您的查询应该类似于
Select * from table1 where emailid=xyz
。First set
visible=false
for those two columns.Then to get only the row u have selected, change the datasourceid and bind the data in the
gridview1_SelectedIndexchanged
event.First the query for datasource it would be like
Select * from table1
.When you are binding for the second time, when you have clicked the select, then you're query should be like
Select * from table1 where emailid=xyz
.您可以使用 RowCommand 事件来执行此操作。就像..
编辑:
You can do this using the RowCommand event. like..
Edit:
要隐藏某些列,您可以在后面的代码中添加以下内容:
这将隐藏
GridView
的第 3 和第 4 列。To hide certain columns you can have this in the code behind:
This will hide the 3rd and 4th columns of the
GridView
.