关于Asp.net? [英] Question about Asp.net?

查看:121
本文介绍了关于Asp.net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于执行虚构任务的gridview,并且有一个employee_id列,我想将其放在gridview之外的一个标签中.

I have a gridview for my fictional tasks and there is a column for employee_id, i want to get it in a lable outside the gridview. how can I get these value from the gridview and to place in variables?

推荐答案

尝试类似的方法:
Try something like:
foreach (GridViewRow item in myGrid.Rows)
{    
   // if employee_id assigned to a label
   Label myLabel = (Label)item.FindControl("myLabel");
   string text = myLabel.Text;
   // Use the string as you want.

   // OR
   // if data directly bind to grid
   string text = item.Cells[employee_id_columnIndex].ToString();
} 


这篇关于关于Asp.net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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