473,621 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Repeater control in a web user control

I have a Repeater control in a web user control.

The web user control has a public method named PopulateRepeate r which takes
an ID as an parameter and populates the repeater control based on the
parameter.

When I call PopulateRepeate r from the User Control page_load event it
populates the repeater without a problem.

When I call PopulateRepeate r from a procedure in the web form which contains
the user control, I get an error in PopulateReader (which is in the User
Control code behind module):

Sub PopulateRepeate r (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataS ource = ds ' causes error "Object reference not set
to an instance of an object"
Repeater1.DataB ind
Exit Sub

Apr 4 '06 #1
4 1798
Apparently, the method called is not returning a DataSet.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"bill" <be****@datamti .com> wrote in message
news:uM******** ******@TK2MSFTN GP04.phx.gbl...
I have a Repeater control in a web user control.

The web user control has a public method named PopulateRepeate r which
takes an ID as an parameter and populates the repeater control based on
the parameter.

When I call PopulateRepeate r from the User Control page_load event it
populates the repeater without a problem.

When I call PopulateRepeate r from a procedure in the web form which
contains the user control, I get an error in PopulateReader (which is in
the User Control code behind module):

Sub PopulateRepeate r (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataS ource = ds ' causes error "Object reference not set
to an instance of an object"
Repeater1.DataB ind
Exit Sub


Apr 5 '06 #2
It's not the dataset, its the Repeater which is 'nothing'.

I found the reason - the way a web user control is declared is different in
VS2005 than VS2003, I guess because of the partial class structure of the
web forms..

In VS2005, I find you just go ahead and call the user control directly using
its ID -- without creating an object variable--in order to call it's methods
from the host code behind:
ucUserControl1. PopulateRepeate r

In VS 2003, the user control first had to be declared in the host code
behind in order to call its methods:
Protected ucUserControl1 as New ucUserControl

If you do this in VS2005, you get an error
"ucUserCont rol1 already declared as... in this class"
so I was using
dim ucUserControl1 as new ucUserControl
and getting the "Object reference not set to an instance of an object"
error.

I'm still getting used to partial classes.

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OT******** ******@TK2MSFTN GP05.phx.gbl...
Apparently, the method called is not returning a DataSet.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"bill" <be****@datamti .com> wrote in message
news:uM******** ******@TK2MSFTN GP04.phx.gbl...
I have a Repeater control in a web user control.

The web user control has a public method named PopulateRepeate r which
takes an ID as an parameter and populates the repeater control based on
the parameter.

When I call PopulateRepeate r from the User Control page_load event it
populates the repeater without a problem.

When I call PopulateRepeate r from a procedure in the web form which
contains the user control, I get an error in PopulateReader (which is in
the User Control code behind module):

Sub PopulateRepeate r (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataS ource = ds ' causes error "Object reference not
set to an instance of an object"
Repeater1.DataB ind
Exit Sub



Apr 5 '06 #3
Glad you got it sorted out!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"bill" <be****@datamti .com> wrote in message
news:u5******** *****@TK2MSFTNG P04.phx.gbl...
It's not the dataset, its the Repeater which is 'nothing'.

I found the reason - the way a web user control is declared is different
in VS2005 than VS2003, I guess because of the partial class structure of
the web forms..

In VS2005, I find you just go ahead and call the user control directly
using its ID -- without creating an object variable--in order to call it's
methods from the host code behind:
ucUserControl1. PopulateRepeate r

In VS 2003, the user control first had to be declared in the host code
behind in order to call its methods:
Protected ucUserControl1 as New ucUserControl

If you do this in VS2005, you get an error
"ucUserCont rol1 already declared as... in this class"
so I was using
dim ucUserControl1 as new ucUserControl
and getting the "Object reference not set to an instance of an object"
error.

I'm still getting used to partial classes.

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OT******** ******@TK2MSFTN GP05.phx.gbl...
Apparently, the method called is not returning a DataSet.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"bill" <be****@datamti .com> wrote in message
news:uM******** ******@TK2MSFTN GP04.phx.gbl...
I have a Repeater control in a web user control.

The web user control has a public method named PopulateRepeate r which
takes an ID as an parameter and populates the repeater control based on
the parameter.

When I call PopulateRepeate r from the User Control page_load event it
populates the repeater without a problem.

When I call PopulateRepeate r from a procedure in the web form which
contains the user control, I get an error in PopulateReader (which is in
the User Control code behind module):

Sub PopulateRepeate r (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataS ource = ds ' causes error "Object reference not
set to an instance of an object"
Repeater1.DataB ind
Exit Sub




Apr 5 '06 #4
Thanks!

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:Os******** ******@TK2MSFTN GP04.phx.gbl...
Glad you got it sorted out!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"bill" <be****@datamti .com> wrote in message
news:u5******** *****@TK2MSFTNG P04.phx.gbl...
It's not the dataset, its the Repeater which is 'nothing'.

I found the reason - the way a web user control is declared is different
in VS2005 than VS2003, I guess because of the partial class structure of
the web forms..

In VS2005, I find you just go ahead and call the user control directly
using its ID -- without creating an object variable--in order to call
it's methods from the host code behind:
ucUserControl1. PopulateRepeate r

In VS 2003, the user control first had to be declared in the host code
behind in order to call its methods:
Protected ucUserControl1 as New ucUserControl

If you do this in VS2005, you get an error
"ucUserCont rol1 already declared as... in this class"
so I was using
dim ucUserControl1 as new ucUserControl
and getting the "Object reference not set to an instance of an object"
error.

I'm still getting used to partial classes.

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OT******** ******@TK2MSFTN GP05.phx.gbl...
Apparently, the method called is not returning a DataSet.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"bill" <be****@datamti .com> wrote in message
news:uM******** ******@TK2MSFTN GP04.phx.gbl...
I have a Repeater control in a web user control.

The web user control has a public method named PopulateRepeate r which
takes an ID as an parameter and populates the repeater control based on
the parameter.

When I call PopulateRepeate r from the User Control page_load event it
populates the repeater without a problem.

When I call PopulateRepeate r from a procedure in the web form which
contains the user control, I get an error in PopulateReader (which is
in the User Control code behind module):

Sub PopulateRepeate r (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataS ource = ds ' causes error "Object reference not
set to an instance of an object"
Repeater1.DataB ind
Exit Sub




Apr 5 '06 #5

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

Similar topics

3
2729
by: anon | last post by:
I am having a hard time with makeing what I am trying to do work. I am making a questionaire web app. I have a custom control that has a label and 5 radio buttons. My problem is that each different topic for the questionaire is in a database and each questionaire will have a different number of questions. I am trying to use a repeater to creat multiple copies of the control, unfortunately when I do this the different controls act like...
5
8254
by: Scott Lyon | last post by:
I am having a strange problem. The program is a bit complex, but I'll try to simplify what I can. I apologize if this is complicated, but I think this would still be simpler than posting a bunch of source code. If you want me to post code, though, just say so. In a nutshell, I've got an ASP.NET application that has one main ASPX page. On that ASPX page, it has a user control (an ASCX) that displays the actual data and controls I need.
3
2850
by: WebMatrix | last post by:
I am struggling with implementing somewhat complicated UI web-control. I explored Repeater, but I am not sure if it's the best way to go. I am leaning towards writing my own custom control and creating elements on the fly dynamically. I have a control that needs to display 3 columns and n number of rows depending on number of records. Sounds simple. But each Row has a control with its own data source binding and value must be selected...
1
5425
by: olduncleamos | last post by:
Hello all, I am experimenting with the repeater control and ran into something that I wasn't expecting. I would appreciate if the experts can confirm or correct my understanding. Here is a fragment of a very simple page that I wrote that will drill down into the displayed item. The result is to be display on the same page so that the user can keep on drilling down:
3
2103
by: Andrew | last post by:
Hi, I am working on a questionnaire. I have displayed a questionnaire using a repeater control. The itemtemplate is as below (quite cut down): <ItemTemplate> <tr><td> <%# DataBinder.Eval(Container.DataItem, "question")%> </td></tr> <tr><td>
8
3019
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the way I'm going about doing this might be a little off. I'd appreciate some help. Below is the code I have thus far but I'm not sure how to reference the user control within the foreach loop. <asp:Panel ID="pnlRosterProfile" runat="Server" />
3
2519
by: Webmills | last post by:
Hi all I have a repeater control containing a web user control within its' item template field. Is it possible to pass through a data field into the web user control, such that this is used when rendering the web user control. I have exposed a parameter of the web user control and attempted to pass in the parameter as below:
7
2999
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm attempting to bind a user control I've written, "ImageBox", to a repeater. The user control takes a custom property, "ContentID", that will execute a database lookup and load an image.
12
2163
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a test page and I've managed to bind the usercontrol to a repeater and display some data in the following fashion: <asp:Repeater ID="Repeater1" runat="server" DataSourceID="ObjectDataSource1"> <ItemTemplate > <uc1:AUserControl runat="server"...
0
8597
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8306
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
8457
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
7127
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
6101
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
5554
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
4065
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
1763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1460
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.