日期:2014-05-18  浏览次数:20472 次

救命啊!!
高手们帮下忙:
我在用户控件中有段html为:
<asp:textbox   id= "txt_Start "   runat= "server "   Width= "100px "   ReadOnly= "True "     onpropertychange= "getEndDate(this, <%#this.txt_EndDate.ClientID%> ); "   AutoPostBack= "True "> </asp:textbox>

其中我想通过   <%#this.txt_EndDate.ClientID%>   找到   txt_EndDate   以便在getEndDate这个js函数中对该控件操作   。

可是我在运行后的html源代码中发现   onpropertychange= "getEndDate(this, <%#this.txt_EndDate.ClientID%> ); "   也就是说     <%#this.txt_EndDate.ClientID%>   被原样传到了客户端   ,没有执行?
怎么解决呢?

------解决方案--------------------
沙发,帮忙顶
------解决方案--------------------
up
------解决方案--------------------
try:

<asp:textbox id= "txt_Start " runat= "server " Width= "100px " ReadOnly= "True " onpropertychange= "getEndDate(this); " AutoPostBack= "True "> </asp:textbox>

function getEndDate(obj){
var id = " <%#this.txt_EndDate.ClientID%> ";
}

不要把 <%#this.txt_EndDate.ClientID%> 放在服务器控件中使用
------解决方案--------------------
在后台写 this.txt_Start.Attributes.Add( "onpropertychange ", "get.....
------解决方案--------------------
up
------解决方案--------------------
BearRui(AK-47) ( 两星(中级))

可行