Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have problem.
1) in GridView itemTemplate use label to show data . i want to retrieve the value of label .
2) how can i change the value of label that retrieve it and change value of it then show the data
Posted
Updated 7-Apr-10 23:11pm
v2

Get Value
string strEmployeeID = ((Label)(GridView1.Rows[0].Cells[3].Controls[1])).Text

You can assign any value to that control as same way get from that control.
Set Value
string strEmployeeID = "EMP001";
((Label)(GridView1.Rows[0].Cells[3].Controls[1])).Text = strEmployeeID 

please change the code based on your requirement.
 
Share this answer
 
v4
Hi,
Please refer the code below.

string str = ((Label)Rows[0].Cells[1].Controls[0])).Text
string str = "Label1";
(((Label)Rows[0].Cells[1].Controls[0])).Text = str; 
 
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