单击Gridview中的复选框,然后在新页面中显示结果 [英] Clicking on a checkbox in a Gridview and displaying the results in a new page

查看:71
本文介绍了单击Gridview中的复选框,然后在新页面中显示结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单击按钮时,如何在新页面中显示所选复选框的详细信息(在网格视图中).

复选框"FIRSTNAME" MIDDLENAME  LASTNAME  GENDER  COUNTRY
[]             b&b        s        nbsp; b              b >
显示(按钮)

如果单击此显示按钮,则需要在新页面中查看选中的复选框..

When clicking on a button, how can i display the details of the selected checkbox (in a gridview) in a new page..

CHECKBOX FIRSTNAME  MIDDLENAME  LASTNAME  GENDER  COUNTRY
[]            fah                       s                d             M         India

DISPLAY(Button)

If i click this display button i need to view the selected checkbox in new page..

推荐答案

尝试查看这些链接,

添加a-gridview-column-of-checkboxes-cs
GridView中的复选框

请参阅第一个链接并用作

Try to see these links,

adding-a-gridview-column-of-checkboxes-cs
CheckBox in GridView

see first link and use as

Session["value"]=row.Cells[1].Controls[0].Text;



//使用会话管理来查看其他页面上的数据
控件[0]将是您的复选框



//use session management to view data on other pages
Controls[0] will be your check box


我假设您的按钮位于网格视图之外,并且只有一个复选框可以一次签入网格视图.

如果是,则在按钮单击事件内.您需要在网格视图中循环以找到选中的项目.

I assume your button is out side the grid view and only one check box can check in the grid view at once.

if so inside the button click event. you need to loop the grid view for find the checked item.

foreach (DataRow dr  in DetailsView1.Rows)
            {

            }




那么有两种方法可以在其他页面上显示.
1)将所有行数据放入当前会话,然后在下一页上显示这些数据.(例如:到string [],然后放入会话)

2)仅获取选中项目的ID,并放入查询字符串或会话中,然后在下一页进行检索.使用该ID,您可以检索属于特定ID的数据,并在所需的任何位置显示.

希望这对您有帮助...

如果您需要更多代码级帮助,请注意...




then there is 2 ways to display in other page.
1) take all row data in to current session and the on the next page show those data.(ex: to string[] and then put in to the session)

2) take only id of checked item and put in to the query string or session and then retrieve on next page. using that id you can retrieve data belongs to particular id and display where ever you want.

hope this will help...

if you need more code level help please noted...


这篇关于单击Gridview中的复选框,然后在新页面中显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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