开发者

Master Pages and changing ID of form tag [duplicate]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜