473,395 Members | 1,404 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,395 software developers and data experts.

Very Strange Problem! (Derived Controls) - Help!

Hi,

I'm pulling my hair out trying to work this out. Pehaps I am
missunderstanding something - hopefully someone can shed some light on this:

1) I have a class library that contains a bunch of custom web controls. Two
of these controls are derived from the TextBox control, and overide the
onLoad method in order to add some client side attributes, eg:

namespace SomeControls{

public class Control1 : System.Web.UI.WebControls.TextBox

{
public Control1 ()
{
}

protected override void OnLoad(EventArgs e)
{
this.Attributes["onblur"] = "some javascript";
base.OnLoad(e);
}
}

}

AND.........

namespace SomeControls{

public class Control2 : System.Web.UI.WebControls.TextBox

{
public Control2 ()
{
}

protected override void OnLoad(EventArgs e)
{
this.Attributes["onfocus"] = "some other javascript";
base.OnLoad(e);
}
}

}

2) I have a some user controls, that contain the custom controls, which are
added Declaratively

3) I Dynamically load one of the user controls into my page depending on
certain factors.

My problem is this: When the page is rendered, some of the custom controls
are rendered incorrectly - they seem to be taking elements from each of the
controls that derive from the TextBox control. For instance, a control that
was declared as SomeControls:Control1 will be rendered with the attributes
from BOTH SomeControls:Control1 and SomeControls:Control2. (eg both the
onBlur and onFocus attributes) !!? To add to the strangeness, sometimes
this happens, and sometimes this does not - If there are 10 instances of
SomeControls:Control1 on the page, sometimes the top who will contain the
elements from SomeControls:Control1 and SomeControls:Control2, while the
rest will render correctly with just the SomeControls:Control1 code.

Its like the two classes SomeControls:Control1 and SomeControls:Control2 are
interfereing with each other somehow.

I hope this makes some sense - it's pretty hard to explain, and personally I
am loosing faith that I can figure out what is going on here. Can someone
exlplain? Please!

Thanks V much

S

Jan 13 '06 #1
1 1175
I understand what you are explaining, but i've never seen this behavior, and
I'm not sure what could possibly be the cause. Any chance of zipping up a
simplified example and sending it to my email (it's somewhat obfuscated, but
you can figure it out :).

Karl

--
http://www.openmymind.net/

"Sosh" <so*******@something.com> wrote in message
news:e3**************@TK2MSFTNGP14.phx.gbl...
Hi,

I'm pulling my hair out trying to work this out. Pehaps I am
missunderstanding something - hopefully someone can shed some light on
this:

1) I have a class library that contains a bunch of custom web controls.
Two of these controls are derived from the TextBox control, and overide
the onLoad method in order to add some client side attributes, eg:

namespace SomeControls{

public class Control1 : System.Web.UI.WebControls.TextBox

{
public Control1 ()
{
}

protected override void OnLoad(EventArgs e)
{
this.Attributes["onblur"] = "some javascript";
base.OnLoad(e);
}
}

}

AND.........

namespace SomeControls{

public class Control2 : System.Web.UI.WebControls.TextBox

{
public Control2 ()
{
}

protected override void OnLoad(EventArgs e)
{
this.Attributes["onfocus"] = "some other javascript";
base.OnLoad(e);
}
}

}

2) I have a some user controls, that contain the custom controls, which
are added Declaratively

3) I Dynamically load one of the user controls into my page depending on
certain factors.

My problem is this: When the page is rendered, some of the custom
controls are rendered incorrectly - they seem to be taking elements from
each of the controls that derive from the TextBox control. For instance,
a control that was declared as SomeControls:Control1 will be rendered with
the attributes from BOTH SomeControls:Control1 and SomeControls:Control2.
(eg both the onBlur and onFocus attributes) !!? To add to the
strangeness, sometimes this happens, and sometimes this does not - If
there are 10 instances of SomeControls:Control1 on the page, sometimes the
top who will contain the elements from SomeControls:Control1 and
SomeControls:Control2, while the rest will render correctly with just the
SomeControls:Control1 code.

Its like the two classes SomeControls:Control1 and SomeControls:Control2
are interfereing with each other somehow.

I hope this makes some sense - it's pretty hard to explain, and personally
I am loosing faith that I can figure out what is going on here. Can
someone exlplain? Please!

Thanks V much

S


Jan 13 '06 #2

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

Similar topics

4
by: Google Mike | last post by:
I have RH9 and am using the PHP and MySQL that came with it. I was doing fine with all manner of my web pages for this app until I started having this very strange problem. It's a work order...
6
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence...
2
by: TB | last post by:
I am seeing a very strange problem as follows... I have a loop where a fair amount of processing is going on and near the top of the loop I access a class that has only static helper functions...
11
by: wASP | last post by:
Hi, I've got a pair of int properties in a class. The properties in question are indexing values - but that's not relevant to my problem - or it's just symptomatic ... sort of. They are...
5
by: cody | last post by:
I have a very funny/strange effect here. if I let the delegate do "return prop.GetGetMethod().Invoke(info.AudioHeader, null);" then I get wrong results, that is, a wrong method is called and I...
3
by: Trapulo | last post by:
I've two copy af the same asp.net application. The application enter on sql server, working with two separate databases (on the same sql server instance, of course). The connection is made with...
2
by: Buddy Ackerman | last post by:
I have a web app that I have setup on numerous web servers. I've set one up for a new client at their hosting facility and cannot get it to connect to their database. I get a "SQL Server does not...
6
by: Chris Ashley | last post by:
I have been tearing my hair out (or indeed, what's left of it) all day with this one. I'm not sure if it's a .NET issue, a server issue or anything else and would appreciate any guidance. ...
112
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not...
126
by: jacob navia | last post by:
Buffer overflows are a fact of life, and, more specifically, a fact of C. All is not lost however. In the book "Value Range Analysis of C programs" Axel Simon tries to establish a...
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:
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
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...
0
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...
0
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...

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.