开发者

Master Pages and changing ID of form tag [duplicate]

开发者 https://www.devze.com 2023-03-19 09:50 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: ASP.NET Form - The form name\\id changes to aspnetForm
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

ASP.NET Form - The form name\id changes to aspnetForm

I'm using Framework V4.0, I used a master page, and a content page.

I put my FORM tag in master page, and I set id of FORM tag to something like "form1" but when I view source of rendered page, I saw that ASP.NET changed id of FORM tag to "aspnetForm".

I mean I have this tag in master page file :

<form id="form1" runat="server">

but after page is rendered, ASP.NET Changed it to :

<form method="post" action="Default.aspx" id="aspnetForm">

as you see id attribute of Form tag is changed. What is r开发者_JS百科eason of behind this?


I don't know the exact reason but when we use master pages the id's of the controls on the content pages changed.

For example. if content page contains a control

after rendering it's ID will become ContentplaceholderID_LabelID

to avoid it set clientID mode property of the control to static.

0

精彩评论

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

关注公众号