Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to select value on the basis of Label ID which is invisible in Grid view.
Posted

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

else

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

and access it using ID.text
 
Share this answer
 
v2
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.

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


In the code behind access the valus as

C#
lblResult.Text = hdnID.Value;


Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900