且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在asp.net c中标签中显示gridview选中的行#

更新时间:2021-11-24 02:49:20

请参考此网址,以下是您的问题的解决方案。



http:/ /www.aspsnippets.com/Articles/How-to-get-Selected-Row-cell-value-from-GridView-in-ASPNet.aspx [ ^ ]
refer this URL, here is the solution for your problem.

http://www.aspsnippets.com/Articles/How-to-get-Selected-Row-cell-value-from-GridView-in-ASPNet.aspx[^]


protected void OnSelectedIndexChanged(object sender, EventArgs e)
{
    string name = GridView1.SelectedRow.Cells[0].Text;
    string country = (GridView1.SelectedRow.FindControl("lblCountry") as Label).Text;

    lblValues.Text = "<b>Name:</b> " + name + " <b>Country:</b> " + country;
}


我正在使用这种方法



Label19.Text = GridView1。 SelectedRow.Cells [1] .Text;

Session(pass_id)= Label19.Text

Response.Redirect(admin_detaileddashboard.aspx)
I am using this method

Label19.Text = GridView1.SelectedRow.Cells[1].Text;
Session("pass_id") = Label19.Text
Response.Redirect("admin_detaileddashboard.aspx")