如何从用户控件中找到控件ID [英] How to find control id from user control

查看:298
本文介绍了如何从用户控件中找到控件ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web用户控件,其中包含"AssociatedLableId"属性和标签.

I have a web user control which contains ''AssociatedLableId'' property and a label.

<uc1:UC id="uc1" run="Ser" AssociatedLableId="lblLable" />


并在aspx页面和已注册的用户控件中添加了一个Label和一个按钮.
现在,当我单击按钮时,aspx页面的标签控件文本将分配给使用JS的Web用户控件的标签控件.
我尝试关注但不正确.


and added a Label and a button in aspx page and registered User Control .
Now when I click the button then the text of label control of aspx page assigned to label control of web user control using JS.
I tried following but not right.

<asp:button id ="btn" run="Ser" text="Click" onClientClick="return assignValue();" />
function assignValue()
{
     document.getElementById('UserControlsAssocitedControlId').value = document.getElementById('aspxPageLableId').value;
}


AssociatedLableId属性用于获取aspx页的Label控件的ID.
我可以找到UserControlsAssocitedControlId的ID,但是如何找到我在JS的AssociatedLableId 属性中分配的aspxPageLableId.


AssociatedLableId property is used to get the Id of aspx page''s Label control.
I can find the Id of UserControlsAssocitedControlId but how can I find the aspxPageLableId which I assigned in the AssociatedLableId property in JS.

推荐答案

此链接,

http://stackoverflow.com/Questions/438556/how-to-access-asp-control-located-in-a-user-control-via-javascript [
Hi, Check this link,

http://stackoverflow.com/questions/438556/how-to-access-asp-control-located-in-a-user-control-via-javascript[^]


这篇关于如何从用户控件中找到控件ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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