开发者

Asp.Net binding

开发者 https://www.devze.com 2023-02-18 18:04 出处:网络
Can I somehow evaluate a binding expression 开发者_开发问答like this in codebehind? \" Click(\'<%#SaveButton.ClientID%>\'); DoSomethingElse(\'<%#CancelButton.ClientID%>\')\"

Can I somehow evaluate a binding expression 开发者_开发问答like this in codebehind?

" Click('<%#SaveButton.ClientID%>'); DoSomethingElse('<%#CancelButton.ClientID%>')"


You should replace '#' by '='.


Supposed you used button, you can do sth like that in codebehind:

Button1.Attributes.Add("onclick", "functionName();");

^^


If it's necessary to bind the script on the page. There is some not very elegant way:

<%# String.Format("Click(\"{0}\";DoSomethingElse(\"{1}\")",SaveButton.ClientID,CancelButton.ClientID) %>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号