javascript 在 ASP.NET 中访问控制客户端名称而不是 ID
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5763557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Accessing control client name and not ID in ASP.NET
提问by nima
I want to fire a server-side ASP.NETbutton click event in JavaScript. I checked the page source and the button
's onclick
in client side is:
我想在 JavaScript 中触发服务器端ASP.NET按钮单击事件。我检查了页面源代码,客户端的button
'sonclick
是:
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$LoginInfo1$btnliOK", "", true, "", "", false, false));
But I have to replace ctl00$LoginInfo1$btnliOK
with something like <%= btnliOK.ClientName %>
. Is there a way to do that?
但我必须ctl00$LoginInfo1$btnliOK
用类似的东西替换<%= btnliOK.ClientName %>
。有没有办法做到这一点?