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

Usercontrol methods

Hi,

I have a usercontrol containing mutually exclusive radiobuttons and I am
trying to use a public function to set a property of the usercontrol based
on which one is checked. However when I refer to the radiobuttons in my
public function (method) the runtime tells me that no object reference has
been set for the radiobutton. How do I grab a reference to my radiobutton
inside my method?

Joe
Nov 18 '05 #1
4 1439
A few days back i needed to pass some value to a user control at run time
and i had asked a similar question

This link was what i got and it does the job

http://www.dotnetjunkies.com/Article...F720AB013.dcik

in short you either declare the user control in code behind or you can user
Page.FindControl to get its reference
and then do whatever you please

HTH

HD

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a usercontrol containing mutually exclusive radiobuttons and I am
trying to use a public function to set a property of the usercontrol based on which one is checked. However when I refer to the radiobuttons in my
public function (method) the runtime tells me that no object reference has
been set for the radiobutton. How do I grab a reference to my radiobutton
inside my method?

Joe

Nov 18 '05 #2
Hi,

Thanks for the quick response - the problem isn't accessing the properties
of the usercontrol - I have figured out how to do that.

What I want to do is call a method of the user control (which I've figured
out how to do) and execute some code in this method that will allow me to
access the checked value of a radiobutton in the user control.and set a
usercontrol property based on the returned value of the radiobutton. I am
having problems referencing the radiobutton to check it's checked value.

Joe

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
A few days back i needed to pass some value to a user control at run time
and i had asked a similar question

This link was what i got and it does the job

http://www.dotnetjunkies.com/Article...F720AB013.dcik
in short you either declare the user control in code behind or you can user Page.FindControl to get its reference
and then do whatever you please

HTH

HD

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a usercontrol containing mutually exclusive radiobuttons and I am
trying to use a public function to set a property of the usercontrol

based
on which one is checked. However when I refer to the radiobuttons in my
public function (method) the runtime tells me that no object reference has been set for the radiobutton. How do I grab a reference to my radiobutton inside my method?

Joe


Nov 18 '05 #3
Hey,

Well if you have figured out how to execute the method on your user control
you should be fine.
ie the method belongs to ascx class and it shouldnt have any problems
accessing the child controls within.

HD

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP09.phx.gbl...
Hi,

Thanks for the quick response - the problem isn't accessing the properties
of the usercontrol - I have figured out how to do that.

What I want to do is call a method of the user control (which I've figured
out how to do) and execute some code in this method that will allow me to
access the checked value of a radiobutton in the user control.and set a
usercontrol property based on the returned value of the radiobutton. I am
having problems referencing the radiobutton to check it's checked value.

Joe

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
A few days back i needed to pass some value to a user control at run time
and i had asked a similar question

This link was what i got and it does the job

http://www.dotnetjunkies.com/Article...F720AB013.dcik

in short you either declare the user control in code behind or you can

user
Page.FindControl to get its reference
and then do whatever you please

HTH

HD

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a usercontrol containing mutually exclusive radiobuttons and I am trying to use a public function to set a property of the usercontrol

based
on which one is checked. However when I refer to the radiobuttons in my public function (method) the runtime tells me that no object reference

has been set for the radiobutton. How do I grab a reference to my radiobutton inside my method?

Joe



Nov 18 '05 #4
Thanks - seems to have bee the way I was declaring my properties.
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hey,

Well if you have figured out how to execute the method on your user control you should be fine.
ie the method belongs to ascx class and it shouldnt have any problems
accessing the child controls within.

HD

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP09.phx.gbl...
Hi,

Thanks for the quick response - the problem isn't accessing the properties
of the usercontrol - I have figured out how to do that.

What I want to do is call a method of the user control (which I've figured out how to do) and execute some code in this method that will allow me to access the checked value of a radiobutton in the user control.and set a
usercontrol property based on the returned value of the radiobutton. I am having problems referencing the radiobutton to check it's checked value.

Joe

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message news:OB**************@TK2MSFTNGP09.phx.gbl...
A few days back i needed to pass some value to a user control at run time and i had asked a similar question

This link was what i got and it does the job

http://www.dotnetjunkies.com/Article...F720AB013.dcik

in short you either declare the user control in code behind or you can

user
Page.FindControl to get its reference
and then do whatever you please

HTH

HD

"Joe Molloy" <mo********@hotmail.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I have a usercontrol containing mutually exclusive radiobuttons and I am
> trying to use a public function to set a property of the
usercontrol based
> on which one is checked. However when I refer to the radiobuttons
in my > public function (method) the runtime tells me that no object

reference has
> been set for the radiobutton. How do I grab a reference to my

radiobutton
> inside my method?
>
> Joe
>
>



Nov 18 '05 #5

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

Similar topics

1
by: Tiago Barbutti | last post by:
I have a UserControl that execute methods in Load event, but it hapens in designMode and generate an error and the control disappear from the form. I read that i can use the DesignMode to kwnow...
4
by: ATS | last post by:
HOWTO: Add methods to C++ UserControl. Please help, I want to add a method to a C++ .NET UserControl that is based off the sample in the MSND article titled: How to automate Internet...
3
by: Peter Rilling | last post by:
Okay, I am probably missing something simple so here is my problem. I have a page. On this page I have a usercontrol. On this user control I have another usercontrol. On each usercontrol I...
0
by: Matt Howeson | last post by:
I have a problem with a usercontrol that is dynamically loaded, from a web control and is not restoring it's viewstate properly. Here's the scenario. Within our content management system, I have...
2
by: DraguVaso | last post by:
Hi, I have a UserControl (MyUserControl) which has a DataGrid (MyDataGrid). I made a new UserControl that Inherits of my first UserControl: I named it MyInheritedUserControl. For some reason...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
5
by: seal | last post by:
OK, I am trying to fire an event from a usercontrol that tells the page when a checkbox was clicked. Here is the control and when I try and wire up the page to catch the event, my event is not...
2
by: bryan | last post by:
Hi all, I am developing a web app in .net 2.0. I have a few DropDownLists that are used on multiple web forms, these show shop locations and employees. Each DDL is placed inside a...
8
by: Tony Johansson | last post by:
Hello! I wonder can somebody explain when is it suitable to use these methods OnKeyUp, OnKeyDown and OnKeyPress because these raise an event. These are located in class UserControl. If these...
2
by: Joe | last post by:
Is it possible to inherit from a UserControl? If I try my user control class is not recognized. Thanks, Joe
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
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,...

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.