使用javascript访问ajax服务器控件属性 [英] Access ajax server control properties using javascript
问题描述
您好。
我创建了一个ajax用户控件,它完美地工作,在网页中使用它。现在,您能帮我解决一下如何使用网页中的javascript访问我的ajax服务器控件属性吗? [我可以使用我的控制标签修改属性]。
Hello.
I created an ajax user control, it works prefectly, Used it in a webpage. Now can you help me please how to access my ajax server control properties using javascript in the webpage? [I can modify properties using my control tag].
<cc1:myControl ID="control1" runat="server" caption="Test" isEditable="true" >
</cc1:myControl>
现在我怎样才能用javascript更改值。我以前试过这个,但没有发生任何事情。
Now how can i change values with javascript. I tried this before, but nothing happend.
var c= $find("<%=control1.ClientID%>");
alert(c.get_caption());
我甚至尝试进行用户控制,但是存在同样的问题,我无法使用javascript访问属性。
谢谢!
I even tried to make an usercontrol, but there is same problem, i cant access properties using javascript.
Thank you!
推荐答案
find( <%= control1.ClientID%>);
alert(c.get_caption());
find("<%=control1.ClientID%>"); alert(c.get_caption());
我甚至尝试进行用户控制,但是存在同样的问题,我无法使用javascript访问属性。
谢谢!
I even tried to make an usercontrol, but there is same problem, i cant access properties using javascript.
Thank you!
正如评论中所述:你不能。您只能修改生成到html中的属性,因为这是JS可以访问的所有属性。
As discussed in comments: You can't. You can only modify the properties that get generated into the html since that is all JS has access to.
这篇关于使用javascript访问ajax服务器控件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!