net中的超链接传递值

net中的超链接传递值

本文介绍了通过asp.net中的超链接传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个网格视图,其中来自多个表的数据都将出现.
四个表格用于填充网格视图,三个字段是网格视图中的计算字段.
在此gridview中,一列是超链接字段,该字段导航到其他页面以显示该超链接字段的详细信息


我的问题是由于多表值,我无法为网格视图定义数据键值,因此我无法理解如何通过超链接传递参数值.
请帮助我,因为它很紧急,我对vb.net

I have created a Grid view in which data from multiple tables are coming.
Four tables are use to fill grid view and three fields are the calculated fields in the grid view.
In this gridview one column is hyperlink field which navigate to other page to show details of that hyperlink field


My problem is that due to multi table values i am unable to define Data Key Value for the grid view and therefore i am unable to understand how to pass parameter value thru hyperlink.
Please help me as it is urgent and i am not very experienced in vb.net

推荐答案

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        int index = Convert.ToInt32(e.Row.Cells[0].Text);
        HyperLink hl = (HyperLink)e.Row.FindControl("HyperLink1");
        hl.NavigateUrl += "?id=" + index;
    }
}


这篇关于通过asp.net中的超链接传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 05:00