473,569 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Incorrect duplicate ID added to server control, leaving it with 2 IDs

Hi All,

I have a custom web control which works perfectly. Its just a
tabcontrol to spit out navigation tabs, it inherits from
System.Web.UI.W ebControls.WebC ontrol

In web page design view, say I give the control an ID of "tab1".

I am getting this weird and very frustrating behaviour:

When the page is rendered, i.e. if you go "View Source" from the
browser, the next server control placed on the page after the "tab1"
control, ends up with two IDs. The first ID is "tab1" (somehow
incorrectly carried over from the "tab1" control above it), and the
second ID is the control's correct ID which it should have, i.e.
"pnlSearch" or something.
In my case, its a Panel that's copping the extra incorrect ID, but I've
tried removing the panel and replacing it with any other server
control, i,e, an <asp:Labelor anything, and as long as its the next
control straight after my "tab1", it ends up having an id="tab1" added
to it incorrectly!

So the panel looks like this when rendered:
<div id="tab1" id="pnlSearch" >

I'm using a lot of CSS, so this multiple ID rubbish is causing me some
grief.

I'm pretty certain something could be not quite spot on with the custom
TabControl. When I remove it, the problem goes away. Its almost like
the TabControl is leaving some variable set with its ID in it, and the
next server control is picking that up and using it, but it needs to be
cleared or something..

Thanks for any insight into this..

Aaron.

Aug 24 '06 #1
2 1491
I have kludged it with a dodgy hack to overcome my problem for now.

Underneath the TabControl, I just placed this:
<asp:Label id="anotherdotn etworkaround" runat="server"> </asp:Label>

Then when rendered, the label becomes a span with the two IDs, i.e.:
<span id="tab1" id="anotherdotn etworkaround"></span>

So now my pnlSearch doesn't confuse the CSS as it only has 1 ID like it
should. And I don't use the redundant workaround span, it just sits
there like a dodgy kludge bloating the document source by a few bytes.

Just so annoying!

Aug 24 '06 #2
Is your control a composite, i.e. is it creating other controls, or are
the tabs just spat out as HTML. If it is a composite, are you
implementing INamingContaine r?

Kevin

aa***@aaconsult .com.au wrote:
Hi All,

I have a custom web control which works perfectly. Its just a
tabcontrol to spit out navigation tabs, it inherits from
System.Web.UI.W ebControls.WebC ontrol

In web page design view, say I give the control an ID of "tab1".

I am getting this weird and very frustrating behaviour:

When the page is rendered, i.e. if you go "View Source" from the
browser, the next server control placed on the page after the "tab1"
control, ends up with two IDs. The first ID is "tab1" (somehow
incorrectly carried over from the "tab1" control above it), and the
second ID is the control's correct ID which it should have, i.e.
"pnlSearch" or something.
In my case, its a Panel that's copping the extra incorrect ID, but I've
tried removing the panel and replacing it with any other server
control, i,e, an <asp:Labelor anything, and as long as its the next
control straight after my "tab1", it ends up having an id="tab1" added
to it incorrectly!

So the panel looks like this when rendered:
<div id="tab1" id="pnlSearch" >

I'm using a lot of CSS, so this multiple ID rubbish is causing me some
grief.

I'm pretty certain something could be not quite spot on with the custom
TabControl. When I remove it, the problem goes away. Its almost like
the TabControl is leaving some variable set with its ID in it, and the
next server control is picking that up and using it, but it needs to be
cleared or something..

Thanks for any insight into this..

Aaron.
Aug 25 '06 #3

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

Similar topics

8
3274
by: Mark | last post by:
When my form goes to a new record, I have a procedure that copies the last record added to the form's underlying table into the form. The intent is that a series of new records may have the same data in many of the fields so I paste in the same values of the previous record and then edit what needs edited in the new record saving much retyping...
2
3201
by: Mr Wizard | last post by:
I am going through the front controller http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpFrontControllerInASP.asp and all works well except when the server.transfer occurs. I get invalid IsPostBack results which I believe can fixed using the patch in KB:821156. How do I get this patch? Another question in the...
1
2300
by: Kepler | last post by:
I have a custom control that is thrown onto a UserControl that is thrown onto a WebForm. Basically, I've got a scenario where if my UserControl sets an attribute on the custom control in the ascx, EnsureChildControls gets called, creating the control before the UserControl is even added to the webform. The problem with this is that the...
3
1451
by: Tumurbaatar S. | last post by:
Hi! I created some user control (ASCX) and it works fine. The control is created one of subfolders of my project, so its namespace looks like: namespace myproject.subfolder1 { public class route : System.Web.UI.UserControl .... In another subfolder I also created second control, but
1
6648
by: dinu | last post by:
Dear Friends, I have table contain 2000 out of those some are duplicate when i select duplicate records by using Enterprise Manager and make modification to one of those duplicate records the following message flashes/display. key columen information is insufficient or incorrect.Too many rows were affected by update pls suggest what is...
2
2532
by: Harry Haller | last post by:
I want to duplicate the form data, edit it to remove some items (such as __EVENTTARGET, __EVENTVALIDATION, etc) and save it to a log. How can I make a duplicate (editable) copy of the Form Collection? The Form Collection is of type NameValueCollection is, underneath the covers, an object of type HttpValueCollection. The problem I have...
0
8294
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new records there is an error "Incorrect syntax near '-'. Must declare the scalar variable "@UserName". I worked out in design view,code is automatically...
1
3185
by: asf93555 | last post by:
Running under SQL2000 I can not get an INSTEAD trigger to function. I've even copied the example directl from books online - no joy . . . Server: Msg 170, Level 15, State 1, Procedure IO_Trig_INS_Employee, Line 2 Line 2: Incorrect syntax near 'INSTEAD'. CREATE TABLE Person ( SSN char(11) PRIMARY KEY, Name ...
7
6642
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: ...
0
7700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
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. ...
0
8125
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7974
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...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
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
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.