473,748 Members | 4,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subclassing Controls

Hello all,

Wondering if anyone has come across this problem I am having..

I am Subclassing a RadioButtonList to add some properties that I need. I am
building up
a table and adding to a placeHolder control. I also register an event
handler
just before finally adding MyRadioButtonLi st to a TableCell control.

On Page_load I call my method that adds a Table containing MyRadioButtonLi st
to the placeholder.

The strange part is, On the first page load, MyRadioButtonLi st Selects the
proper ListItem
I have specified in code. on all subsequent postbacks it selects the first
listitem in MyRadioButtonLi st. I have stepped through the code and
everything seems to be fine. However on the first postback the
SelectedItemCha nged event fires, and the first listItem is selected,
Contrary to what I have in code. And all subsequent postbacks have the first
item selected and no event fires.

Any Ideas?

Thanks Guys,
Robert.
Nov 18 '05 #1
2 1637
Hi, Robert,

First, which methods of RadioButtonList do you override? Then, if you're
changing the values of the RadioButton's, it may be that you are breaking
the logic in the protected method IPostBackDataHa ndler.LoadPostD ata and you
will need to override it.

Second, you say:
I also register an event handler
just before finally adding MyRadioButtonLi st to a TableCell control.
Do you attach to the event on every Page_Load or only when IsPostBack is
false? Maybe this is the problem - you need to subscribe for the event on
every Page_Load.

Greetings
Martin
"TheStripe" <Th*******@yaho o1221x.com> wrote in message
news:c5******** ************@co mcast.com... Hello all,

Wondering if anyone has come across this problem I am having..

I am Subclassing a RadioButtonList to add some properties that I need. I am building up
a table and adding to a placeHolder control. I also register an event
handler
just before finally adding MyRadioButtonLi st to a TableCell control.

On Page_load I call my method that adds a Table containing MyRadioButtonLi st to the placeholder.

The strange part is, On the first page load, MyRadioButtonLi st Selects the
proper ListItem
I have specified in code. on all subsequent postbacks it selects the first
listitem in MyRadioButtonLi st. I have stepped through the code and
everything seems to be fine. However on the first postback the
SelectedItemCha nged event fires, and the first listItem is selected,
Contrary to what I have in code. And all subsequent postbacks have the first item selected and no event fires.

Any Ideas?

Thanks Guys,
Robert.

Nov 18 '05 #2
Morning Martin,

I subClassed the control to add a few public propertys that I am using
to pass around added information I need in the Selected Item Changed event.
I did not override any thing in the base class. Thanks for helping figure
this out.

"Martin Dechev" wrote:
Hi, Robert,

First, which methods of RadioButtonList do you override? Then, if you're
changing the values of the RadioButton's, it may be that you are breaking
the logic in the protected method IPostBackDataHa ndler.LoadPostD ata and you
will need to override it.

Second, you say:
I also register an event handler
just before finally adding MyRadioButtonLi st to a TableCell control.


Do you attach to the event on every Page_Load or only when IsPostBack is
false? Maybe this is the problem - you need to subscribe for the event on
every Page_Load.

Greetings
Martin
"TheStripe" <Th*******@yaho o1221x.com> wrote in message
news:c5******** ************@co mcast.com...
Hello all,

Wondering if anyone has come across this problem I am having..

I am Subclassing a RadioButtonList to add some properties that I need. I

am
building up
a table and adding to a placeHolder control. I also register an event
handler
just before finally adding MyRadioButtonLi st to a TableCell control.

On Page_load I call my method that adds a Table containing

MyRadioButtonLi st
to the placeholder.

The strange part is, On the first page load, MyRadioButtonLi st Selects the
proper ListItem
I have specified in code. on all subsequent postbacks it selects the first
listitem in MyRadioButtonLi st. I have stepped through the code and
everything seems to be fine. However on the first postback the
SelectedItemCha nged event fires, and the first listItem is selected,
Contrary to what I have in code. And all subsequent postbacks have the

first
item selected and no event fires.

Any Ideas?

Thanks Guys,
Robert.


Nov 18 '05 #3

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

Similar topics

6
2732
by: WhiteRavenEye | last post by:
Why can't I subclass any window except mine in VB? Do I have to write dll for this? I've tried to subclass it with SetWindowLong but without success... Does anyone know how to subclass window ANY window in VB? Thanks...
2
5160
by: BJörn Lindqvist | last post by:
A problem I have occured recently is that I want to subclass builtin types. Especially subclassing list is very troublesome to me. But I can't find the right syntax to use. Take for example this class which is supposed to be a representation of a genome: class Genome(list): def __init__(self): list.__init__(self) self = ....
11
3478
by: Brent | last post by:
I'd like to subclass the built-in str type. For example: -- class MyString(str): def __init__(self, txt, data): super(MyString,self).__init__(txt) self.data = data
5
6489
by: Pieter Linden | last post by:
Hi, This question refers sort of to Rebecca Riordan's article on Access web about subclassing entities: http://www.mvps.org/access/tables/tbl0013.htm How practical is this? I am writing a database to track Computer equipment/inventory as well as other devices. Computers, of course, have software installed, so I want to keep track of that. I was
7
1836
by: Simon | last post by:
I've struggled manfully and have finally managed to subclass the Common Dialog class to add my own controls. My last problem is how to set the lpfnHook attribute of the OPENFILENAME structure. This needs to be declared as an integer (IntPtr / delegate class refuses to work). So, how can I cast (AddressOf MyHookFunction) into an integer? Thanks
1
2295
by: Steamboat | last post by:
I have read two excellent articles on how to subclass .NET controls so that you can hook into the control’s WndProc, which is very helpful since you cannot access the WndProc directly for .NET Compact Framework controls. The links are: http://blog.opennetcf.org/ayakhnin/CategoryView.aspx?category=ListView http://blogs.msdn.com/netcfteam/archive/2005/07/24/442616.aspx Sub-classing allows you to trap windows messages and provide...
6
1403
by: Its Me Ernest T. | last post by:
I am looking for any information about how I could subcass a form I don't own and resize some buttons. We run a application which is extreamly legacy and the company has long since went out of business. This application will install on WinXP but the buttons on the form are smaller than they should be. I would like to hook into this form and resize the buttons. I remember working on things like this a few years back with VB but its...
16
2077
by: manatlan | last post by:
I've got an instance of a class, ex : b=gtk.Button() I'd like to add methods and attributes to my instance "b". I know it's possible by hacking "b" with setattr() methods. But i'd like to do it with inheritance, a kind of "dynamic subclassing", without subclassing the class, only this instance "b" ! In fact, i've got my instance "b", and another class "MoreMethods"
5
2531
by: Ray | last post by:
Hi all, I am thinking of subclassing the standard string class so I can do something like: mystring str; .... str.toLower (); A quick search on this newsgroup has found messages by others
0
8826
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
9534
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...
0
9241
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
8239
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...
1
6793
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
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
4597
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...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
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

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.