本文介绍了如何找到控制客户端ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在下面,btnBook1是服务器按钮控件ID。只是我想访问这个button.btnBook1的客户端id动态存在。所以当按钮不存在时,这行代码返回error.please提供了一种方式,所以我可以访问控件的客户端ID。
var str = jquery(#<%= btnBook1.ClientID%>)。attr(id)。toString();
请尽快提供解决方案。
提前谢谢
In below btnBook1 is a server button control id. just i want to access client id of this button.btnBook1 exists dynamically.so when button does not exists then this line of code return error.please provide a way so i can access client id of control.
var str = jquery("#<%=btnBook1.ClientID%>").attr("id").toString();
Please provide solution as soon as possible.
thanks in advance
推荐答案
<%=(this.FindControl("btnBook1") == null) ? "" : this.FindControl("btnBook1").ClientID%>
这篇关于如何找到控制客户端ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!