如何将datagrid视图的一列值传输到其他aspx页面. [英] How to transfer One column value of datagrid view to other aspx page.+

查看:67
本文介绍了如何将datagrid视图的一列值传输到其他aspx页面.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我的项目有一个gridview,其中包含4列.实际上,我想向其他aspx页面显示一个列值.
例如:假设列名是student_name.有10个螺柱名称是网格视图.我想将此梭哈名称转移到其他页面.

提前thnx
Sumit

Hi in my projet there are one gridview this contains 4 columns . Actually I want to show one column value to other aspx page.
Eg: suppose the column name is student_name. there are 10 stud names is grid view. i want to transfer this stud name an other page.

thnx in advance
Sumit

推荐答案



根据您的要求尝试这种类型的代码

Hi,

try this type of code for your requirement

   List<string> names = new List<string>();
        foreach (GridViewRow gr in gv.Rows)
        {
            names.Add(gr.Cells[2].ToString());
        }
        Session["names"] = names;
</string></string>



在上面,您必须在单元格[columnindex]中使用列索引

然后将这些值存储在会话中,然后在下一页中使用该会话值

最好的



In the above you''ve to use your column index in cells[columnindex]

then store those values in session after that use that session value in nextpage

All the Best


这篇关于如何将datagrid视图的一列值传输到其他aspx页面.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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