访问控制客户端名称,并在ASP.NET没有ID [英] Accessing control client name and not ID in ASP.NET
问题描述
我想火的服务器端 ASP.NET 按钮单击事件。我查了一下网页的源文件和按钮
的的onclick
在客户端是:
I want to fire a server-side ASP.NET button click event in JavaScript. I checked the page source and the button
's onclick
in client side is:
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$LoginInfo1$btnliOK", "", true, "", "", false, false));
不过,我有类似&LT替换
。有没有办法做到这一点? ctl00 $ LoginInfo1 $ btnliOK
;%= btnliOK.ClientName%GT;
But I have to replace ctl00$LoginInfo1$btnliOK
with something like <%= btnliOK.ClientName %>
. Is there a way to do that?
推荐答案
您可以通过
btnliOK.UniqueID
<一个href=\"https://msdn.microsoft.com/en-us/library/system.web.ui.control.uniqueid(v=vs.110).aspx\"><$c$c>UniqueID$c$c>给人的页面上呈现的名称结果
<一href=\"https://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid(v=vs.110).aspx\"><$c$c>ClientID$c$c>给人的页面上呈现的标识结果
<一href=\"https://msdn.microsoft.com/en-us/library/system.web.ui.control.id(v=vs.110).aspx\"><$c$c>ID$c$c>给的,你可以使用背后code
这篇关于访问控制客户端名称,并在ASP.NET没有ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!