如何访问.cs页面上的templatefield中的标签 [英] How to access label in templatefield on .cs page

查看:69
本文介绍了如何访问.cs页面上的templatefield中的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Grigview的Templatefield来显示图像框中的图像,标签控件中的名称以及iteam模板中标签控件中的Id。所有工作正常,它显示数据,因为我需要但我想在页面上的代码访问标签中的Id的值。即,当我尝试访问标签说lblID它给出错误标签未找到gridview控件在.ascx页面。



我尝试过:



我正在使用Grigview的Templatefield来显示图像框中的图像,标签控件中的名称以及迭代模板中标签控件中的Id。所有工作正常,它显示数据,因为我需要但我想在页面上的代码访问标签中的Id的值。即当我尝试访问Label时说lblID它给出错误标签未找到gridview控件在.ascx页面。

解决方案

这里有代码显示你如何访问gridviews内部的控件等



查找控件| ASP.NET论坛 [ ^

I am using Templatefield of Grigview to show image in imagebox, name in label control and Id in Label Control in iteam template. All work fine it is showing data as I required but I want to access value of Id in Label on code behind page. i.e when I try to accesss Label say lblID it is giving error Label not found gridview control is on .ascx page.

What I have tried:

I am using Templatefield of Grigview to show image in imagebox, name in label control and Id in Label Control in iteam template. All work fine it is showing data as I required but I want to access value of Id in Label on code behind page. i.e when I try to accesss Label say lblID it is giving error Label not found gridview control is on .ascx page.

解决方案

There is code here that shows how you access controls inside of gridviews etc

Finding controls | The ASP.NET Forums[^]


这篇关于如何访问.cs页面上的templatefield中的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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