473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Form controls names are changed when using MasterPage features

Hi all....

I am programming in ASP.NET 2.0 and VS.NET 2005 Beta 2.

I have a MasterPage that provides basic look & feel for my pages.

The main form present in the master page has this element:

<form .... runat="server">
........
<div>
<asp:contentplaceholder id="Contenido" runat="server">
</asp:contentplaceholder>
</div>
</form>

The page that uses the master page has form controls, one of them is named
txtPoliza.

Well.. when I load the page in the browser, all controls changed their name,
for example, using the same example txtPoliza, the field is renamed to
ctl00$Contenido$txtPoliza, of course, affecting JavaScript code I have in the
page.

How can I solve it?
Thanks

Jaime
Nov 19 '05 #1
1 3232
You can't. The IDs are generated basedupon the control's nesting in the server
side control tree. The master is a control itself inserted between the page
and your <asp:Content> controls. If you want to use javascript on the page
to get the ID of the control use the Control.ClientID and dynamically modify
your javascript to use that ID.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi all....

I am programming in ASP.NET 2.0 and VS.NET 2005 Beta 2.

I have a MasterPage that provides basic look & feel for my pages.

The main form present in the master page has this element:

<form .... runat="server">
.......
<div>
<asp:contentplaceholder id="Contenido" runat="server">
</asp:contentplaceholder>
</div>
</form>
The page that uses the master page has form controls, one of them is
named txtPoliza.

Well.. when I load the page in the browser, all controls changed their
name, for example, using the same example txtPoliza, the field is
renamed to ctl00$Contenido$txtPoliza, of course, affecting JavaScript
code I have in the page.

How can I solve it?
Thanks
Jaime


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: winshent | last post by:
I have copied approx 20 controls from a form to a tab control for reasons of space. i now cannot run code triggered by the events of these controls. for example, the following will not trigger...
1
by: Ray Cacciatore | last post by:
My login.aspx page uses a MasterPage and is implemented as a Content page. However, I keep getting the error "A page can have only one server-side Form tag." when I run it. Yet there is not FORM tag...
4
by: sck10 | last post by:
I changed my aspx page to use a master page. The problem is that I can no longer loop through the controls on the content page. My question is how do you loop through the controls on the master...
2
by: Joseph James | last post by:
Hi all, I am very new to ASP.net. As I was going through new features of asp.net, I came across Masterpage and I tried to use it. But when the form is posted to another page, the key names of the...
2
by: Mark | last post by:
Hi all, I have a WYSIWYG editor which allows people to insert a form into a page. This information is stored in a database and at run-time is displayed inside a content placeholder (I'm using...
3
by: rgparkins | last post by:
Hi This has been asked before but with no resolution so I am putting it out there again in case someone has an answer. 2 user controls with same name List.ascx but different namespace, and I...
4
by: Joe | last post by:
We are working on a project that requires 3rd parties (ie, consultants) to use our ASP.net webforms in a very reusable manner. The big catch is that we are not allowed to give them source. There...
7
by: WT | last post by:
Hello, It seems that when a control is set into a ContentPlaceHolder in a page using a MasterPage, it's id is change and FindControl(ID) no more works, is it normal, how to override this or...
9
by: dhtml | last post by:
I have written an article "Unsafe Names for HTML Form Controls". <URL: http://jibbering.com/faq/names/ > I would appreciate any reviews, technical or otherwise. Garrett --...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.