母版页ControlId [英] Master Pages ControlIds

查看:169
本文介绍了母版页ControlId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在asp.net项目(框架3.5)中使用母版页.在本地呈现页面后,控件ID会像"ctl00_ContentPlaceHolder1_controlid"一样变化.但是控件ID在服务器上呈现后不包含"ctl00_",它看起来像"ContentPlaceHolder1_controlid".那么,为什么在主机上不控制id包含"ctl00_"呢?

请帮帮我.

在此先感谢.

Hi All,

I''m using master page in my asp.net project(framework 3.5). The control ids are changing like "ctl00_ContentPlaceHolder1_controlid" after page rendered at the local. But control ids not contain "ctl00_" after rendered at the server, it looks like "ContentPlaceHolder1_controlid". So why don''t control ids contain "ctl00_" at the host?

Please help me.

Thanks in Advance.

推荐答案

您永远不要从查看源代码中复制控件ID.根据需要使用控件的ClientID属性将这些值传递给javascript.
You should NEVER copy the control ids from viewing the source. Use the ClientID property of the control to pass those values through to your javascript as needed.


答案在这里(http://goo.gl/IBYG6).
我的托管服务器将其asp.net服务器更改为asp.net 4服务器.因此,我的控件呈现为"ctl00_".我将.net 3.5项目编译为.net 4,并更改了web.config文件,如下所示(http://goo.gl/aOXip)

现在可以正常工作了.

在此先感谢.
Answer is here(http://goo.gl/IBYG6).
My hosting server changed their asp.net servers to asp.net 4 server. So my controls rendered withouth "ctl00_". I compiled my .net 3.5 project to the .net 4 and i i changed web.config file like this(http://goo.gl/aOXip)

Now its working.

Thanks in Advance.


这篇关于母版页ControlId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆