有没有一种方法可以防止ASP

有没有一种方法可以防止ASP

本文介绍了有没有一种方法可以防止ASP.Net破坏控件ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个控件:

I have a control:

<asp:TextBox ID="ControlName" runat="server" />



我想在一些Javascript中引用它.

ASP.Net将ID修改为ctl00_ContentPlaceHolder1_ControlName.
为了简单起见,我想在脚本中将其称为ControlName:页面的未来版本可能会将控件放在不同的容器中,这会更改ID,并且我宁愿不必记住重写脚本.



I want to reference it in some Javascript.

ASP.Net mangles the ID into ctl00_ContentPlaceHolder1_ControlName.
To keep things simple I want to refer to it as ControlName in my script: future versions of the page might have the control in a different container which would alter the ID, and I would rather not have to remember to rewrite the script.

Is there any way to instruct ASP.Net, either for this specific control or generally, NOT to mangle the ID?

推荐答案


这篇关于有没有一种方法可以防止ASP.Net破坏控件ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 05:20