在aspx.cs页面标签不存在.. [英] In aspx.cs page label are not exist..

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

问题描述

为什么在aspx.cs页面中labal id不存在..而且value也是



我尝试了什么:



lblID.innertext = ...

txtname.value =;
lblid中的
错误value

解决方案

确保标签上有 runat =server属性。

 <   asp:label     id   =  lblID       runat   = 服务器    >  <   / asp:label  >  





为了获取/设置 标签<中的 / code>控制或 TextBox ,使用文本 aspx.cs中的属性

 lblID.Text =  某个值; 



 txtname.Text =  某些名称; 





.value .innerText 仅适用于 Javascript ,或者您应使用属性 [ ^ ]在c#中设置值

Why in aspx.cs page labal id is not exist..and "value " is also

What I have tried:

lblID.innertext=...
txtname.value="";
error in lblid and value

解决方案

Make sure that the label is having runat="server" attribute.

<asp:label id="lblID" runat="server"></asp:label>



Inorder to Get/Set the value from Label Control or TextBox , use Text Property in aspx.cs

lblID.Text = "some value";


txtname.Text = "Some Name";



.value and .innerText works only on Javascript or you shall use Attributes[^] to set the value in c#


这篇关于在aspx.cs页面标签不存在..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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