why does the form id get renamed

A

Abraham Luna

i have a master page with this code in it:

<%@ Master %>
<html>
<head>
<title>Web App</title>
</head>
<body>
<form id="frmMain" runat="server">
<asp:contentplaceholder id="cphMainContent" runat="server">Default
Content</asp:contentplaceholder>
</form>
</body>
</html>

and a content page with this code in it:

<%@ Page Language="C#" MasterPageFile="MasterPage.master" %>
<script language="c#" runat="server">

void Page_Load(Object Sender, EventArgs E)
{

}

</script>
<asp:content id="contentCustomerName" contentplaceholderid="cphMainContent"
runat="server">
<asp:TextBox ID="tbName" runat="server" />
</asp:content>

and this is the rendered html:


<html>
<head>
<title>Web App</title>
</head>
<body>
<form method="post" action="customers.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJNTkyOTExNDAwZGQPvWaSKqwRSSNIY3SFgXih+5aVbg==" />
</div>


<input name="ctl00$cphMainContent$tbName" type="text"
id="ctl00_cphMainContent_tbName" />

</form>
</body>
</html>

my first question is why did the form id get reset to aspnetForm?
and how can i get the rendered input id to be just tbName instead of
ctl00_cphMainContent_tbName

thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top