473,832 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vs2005 HTML issue : "Another object on this page already uses ID"

here is the html :

<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="<%=LABEL _WIDTH%>" class="formtext "><%= HTEXT("Connecti on
type:")%></td>
<td class="formtext ">
<input type="radio" class="inputRad io" id="dbStatus" name="dbStatus"
value="1" onclick="change DbStatus(1)" <%if dbStatus=1 then%checked
<%end if%>><%= HTEXT("Control Server") %>
<input type="radio" class="inputRad io" id="dbStatus" name="dbStatus"
value="0" onclick="change DbStatus(1)" <%if dbStatus=0 then%checked
<%end if%>><%= HTEXT("Historic al Database") %>
</td>
</tr>
</table>
here is the error :

Another object on this page already uses ID 'dbstatus'

with squiggles under both occurrences of dbstatus .
Here is my colleague's take :

In classic HTML, this is very legal and common. The radio button that is
selected is the only one that posts back to the server. Its named value,
either 0 or 1, is sent back.

Even the duplicate id attributes are valid, as Jscript will just see an
array of two <inputobjects , not just a non-array of one object.

So, what is the way to do this same thing in ASPX?




Jul 20 '06 #1
4 4897
"chaz" wrote ...
here is the html :

<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="<%=LABEL _WIDTH%>" class="formtext "><%= HTEXT("Connecti on
type:")%></td>
<td class="formtext ">
<input type="radio" class="inputRad io" id="dbStatus" name="dbStatus"
value="1" onclick="change DbStatus(1)" <%if dbStatus=1 then%checked
<%end if%>><%= HTEXT("Control Server") %>
<input type="radio" class="inputRad io" id="dbStatus" name="dbStatus"
value="0" onclick="change DbStatus(1)" <%if dbStatus=0 then%checked
<%end if%>><%= HTEXT("Historic al Database") %>
</td>
</tr>
</table>
give them unique ID's, but keep the name attributes the same...

Rob
Jul 20 '06 #2
Hello Chaz,

According to the lastest html specifications such as the html4.0 or xhtml,
each element on the html page should has a unique id. And the VS 2005 html
editor use "XHTML 1.0 Transitional" to validate the aspx page template,
therefore, you'll get the "Another object on this page already uses ID xxx"
error message at design-time. To resolve this, you can assign each radio
button element an unique id value(use the "name" attribute to group them
instead).

Also, I've got from your first message that your concern here is how to
manipulate the radio button elements(in the same group) through a element
array rather than individual elements in client-side script, correct? As
for this point, I think we can use the "document.getEl ementByNames" to get
the list of radio button elements( in a certain group, with the same name
attribute) and process them through an array. For example, the following
script function get a list of radio elements through their name (group
name) and access each of them:

=======javascri pt=========
function display()
{
var list = document.getEle mentsByName("Ra dioButtonList1" );
var i = 0;

for(i=0;i<list. length;i++)
{
var radio = list[i];
alert(radio.id) ;
}
}
==============

In addition, in ASP.NET, there is a RadioButtonList control that can help
simplify our work on creating list of Radiobuttons(be long to same group) on
the page. The RadioButtonList support populate radiobutton items by the
following means:

1. statically define radio button items in RadioButtonList 's aspx template

2. programmaticall y create radio button items in code(add them into
RadioButtonList .Items collection)

3. use databinding to populate items (from some certain datasource).

You can find detailed information about the RadioButton and RadioButtonList
server control and how to use them in ASP.NET 2.0:

#RadioButton and RadioButtonList Web Server Controls
http://msdn2.microsoft.com/en-us/library/5xf4ea25.aspx

If there is anything unclear or any other questions, please feel free to
post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial

response from the community or a Microsoft Support Engineer within 1
business day is

acceptable. Please note that each follow up response may take approximately
2 business days

as the support professional working with you may need further investigation
to reach the

most efficient resolution. The offering is not appropriate for situations
that require

urgent, real-time or phone-based interactions or complex project analysis
and dump analysis

issues. Issues of this nature are best handled working with a dedicated
Microsoft Support

Engineer by contacting Microsoft Customer Support Services (CSS) at

http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 21 '06 #3
This is quite helpful Steven ,
Thank you and Rob for the replies .
-chaz

"Steven Cheng[MSFT]" wrote:
Hello Chaz,

According to the lastest html specifications such as the html4.0 or xhtml,
each element on the html page should has a unique id. And the VS 2005 html
editor use "XHTML 1.0 Transitional" to validate the aspx page template,
therefore, you'll get the "Another object on this page already uses ID xxx"
error message at design-time. To resolve this, you can assign each radio
button element an unique id value(use the "name" attribute to group them
instead).

Also, I've got from your first message that your concern here is how to
manipulate the radio button elements(in the same group) through a element
array rather than individual elements in client-side script, correct? As
for this point, I think we can use the "document.getEl ementByNames" to get
the list of radio button elements( in a certain group, with the same name
attribute) and process them through an array. For example, the following
script function get a list of radio elements through their name (group
name) and access each of them:

=======javascri pt=========
function display()
{
var list = document.getEle mentsByName("Ra dioButtonList1" );
var i = 0;

for(i=0;i<list. length;i++)
{
var radio = list[i];
alert(radio.id) ;
}
}
==============

In addition, in ASP.NET, there is a RadioButtonList control that can help
simplify our work on creating list of Radiobuttons(be long to same group) on
the page. The RadioButtonList support populate radiobutton items by the
following means:

1. statically define radio button items in RadioButtonList 's aspx template

2. programmaticall y create radio button items in code(add them into
RadioButtonList .Items collection)

3. use databinding to populate items (from some certain datasource).

You can find detailed information about the RadioButton and RadioButtonList
server control and how to use them in ASP.NET 2.0:

#RadioButton and RadioButtonList Web Server Controls
http://msdn2.microsoft.com/en-us/library/5xf4ea25.aspx

If there is anything unclear or any other questions, please feel free to
post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial

response from the community or a Microsoft Support Engineer within 1
business day is

acceptable. Please note that each follow up response may take approximately
2 business days

as the support professional working with you may need further investigation
to reach the

most efficient resolution. The offering is not appropriate for situations
that require

urgent, real-time or phone-based interactions or complex project analysis
and dump analysis

issues. Issues of this nature are best handled working with a dedicated
Microsoft Support

Engineer by contacting Microsoft Customer Support Services (CSS) at

http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 21 '06 #4
Thanks for your response Chaz,

Glad that the information is of assistance.

If you need any further assistance later, please feel free to post here.

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 21 '06 #5

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

Similar topics

1
2267
by: sjoerd | last post by:
Hi, How can I force to display a HTML-page in the "maximized"-position? Thanks, Sjoerd
5
2286
by: Nick Li | last post by:
Hi, I need to create a html page so that "Back" button(or some other button) is disabled in IE browser. I would appreciate your help. Nick Li
7
2009
by: Shapper | last post by:
Hello, I have an ASP:ImageButton where I want to call a function and pass a string: OnClick="Change_Photo("John")" I am having problems with "". I tried
3
1391
by: Bill J | last post by:
For a VB.NET 2003 standard Windows MDI application, is there a way of implementing the "What's This" functionality through the applications main Help menu? All forms in the application have a HelpProvider. The forms do not have the 'HelpButton' property enabled because they are not dialogs. Thanks.
6
2497
by: blueapricot416 | last post by:
I have some javascript in a standard HTML page that uses the ubiquitous "XMLHttpRequest" to send data to a remote ASP page. If that page "answers back" by sending a string using a simple Response.Write, which I then use in the original HTML page to dynamically update stuff, is this "AJAX"? Specifically, is there anything "wrong" with sending back info from classic ASP pages using simple Response.Writes? (Is there usually something...
13
4253
by: DH | last post by:
Hi, I'm trying to strip the html and other useless junk from a html page.. Id like to create something like an automated text editor, where it takes the keywords from a txt file and removes them from the html page (replace the words in the html page with blank space) I'm new to python and could use a little push in the right direction, any ideas on how to implement this? Thanks!
33
2399
by: STILL LEARNING | last post by:
I'm not sure if this can even be done, but what prompts the question is my desire to be able to create an "Uber Link" script/code of some sort, such that even if the html page contains nothing but a background image -or- a background color -- in other words, the page has neither content nor placed images -- any click, ANYWHERE, will launch the URL in your browser. I realize I can make traditional text links and graphics links; what I'm...
5
6490
by: anEchteTrilingue | last post by:
Hi everybody. Thank you for reading my post. I am having trouble getting "this" to work in all versions of IE (it's fine in Firefox, opera, konqueror, etc). What I would like to do is add an event listener to an element to change its border on mouseover and mouseout. I don't want to use CSS to do this (long story). The problem is that "this" does not work at all in IE for me. I tried to do a try/catch statement and use...
10
2757
by: jollysr | last post by:
Could someone please help me convert the following XML to HTML page? <?xml version="1.0" encoding="UTF-16"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <ns1:doGoogleSearchResponse xmlns:ns1="urn:GoogleSearch"...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10780
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10540
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9319
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4421
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.