如何使用超链接将gridview值作为会话传递 [英] How to pass the gridview value as session using hyperlink

查看:78
本文介绍了如何使用超链接将gridview值作为会话传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..



我有一个gridview超链接。



我可以通过会话将一个值传递到下一页。



对于那个使用下面给出的编码。



Hi..

I have one gridview hyperlink.

From that i can pass one value to the next page using session.

For that am using the coding given below.

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As GridViewSelectEventArgs) Handles GridView1.SelectedIndexChanged        
Dim row As GridViewRow = GridView1.Rows(e.NewSelectedIndex)        
Session("id") = row.Cells(1).Text    
End Sub 





并在下一页中通过标签接收





and receive in the next page by the label

Label1 .Text = Convert.ToString(Session("id")) 





但是,它并没有后退价值并显示在下一页。



帮助我解决这个问题。



But, it is not retreive the value and shown in the next page.

Help me to solve this problem.

推荐答案

单元格内部有HyperLink控件。这就是你应该寻找的。



试试这个:

The cell is having HyperLink control inside it. This is what you should be looking for.

Try this:
Dim row As GridViewRow = GridView1.Rows(e.NewSelectedIndex)    
Dim hyperlink1 As HyperLink = CType(row.Cells(1).FindControl("YourHyperLinkID"), HyperLink)
Session("id") = hyperlink1.Text







--Amit




--Amit


这篇关于如何使用超链接将gridview值作为会话传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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