开发者

id in controls automatically changes

I'm writing a bit of jquery to access a dro开发者_C百科pdown, but .net automatically changes the id by adding ctl00$...

Is there any way to stop it from changing it?

Thanks


The ID is changed because your page could have multiple controls containing child items with duplicate IDs, or the master page might as well. I find it best to only use class selectors when dealing with jQuery and ASP.NET WebForms.


If you are running on ASP.NET 4.0 you could use static or predictable ids. If not you could append a CSS class to your control and use CSS class selector in jQuery instead of id selector.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜