从gridvew中选择Id [英] select Id from gridvew

查看:98
本文介绍了从gridvew中选择Id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据在Grid视图中不可见的Label ID 选择值。

how to select value on the basis of Label ID which is invisible in Grid view.

推荐答案

您可以将DatakeyNames与ID一起使用在gridview本身。并在gridview活动中获取ID。



其他



您可以使用以下内容:

You can use DatakeyNames with ID in the gridview itself. and Grab the id in gridview event.

else

you can use the following:
Label ID = (Label)Gridview1.Rows[e.RowIndex].FindControl("labelid");



并使用ID.text访问它


and access it using ID.text






您可以使用隐藏字段并在将数据加载到网格期间将id值绑定到隐藏字段。



Hi,

You can use a hidden field and bind the id value to the hidden field during the loading of the data to the grid.

<asp:hiddenfield id="hdnID" runat="Server" value="<%" xmlns:asp="#unknown">/></asp:hiddenfield>





在访问后面的代码中valus as





In the code behind access the valus as

lblResult.Text = hdnID.Value;





谢谢



Thanks


这篇关于从gridvew中选择Id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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