How to get Text value of Label-controls in cells of GridView?

陌路散爱 提交于 2019-12-14 03:17:25

问题


In my GridView there is a column containing Label-controls as value. I need to know how to access each Label-control to get its Text value. Any help is appreciated.


回答1:


You can store its value in a hidden field and place it in any other column. Then when you retrieve that row value you can access that hiddenfield value




回答2:


handle selectedIndexChanged event and in it do

string text = ((Label)grid.SelectedRow.Cells[cellIndex]).Text;

string text = grid.SelectedRow.Cells[0].Text; // this should do the trick


来源:https://stackoverflow.com/questions/5270196/how-to-get-text-value-of-label-controls-in-cells-of-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!