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

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 PopulateRepeater which takes
an ID as an parameter and populates the repeater control based on the
parameter.

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

When I call PopulateRepeater 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 PopulateRepeater (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataSource = ds ' causes error "Object reference not set
to an instance of an object"
Repeater1.DataBind
Exit Sub

Apr 4 '06 #1
4 1773
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**************@TK2MSFTNGP04.phx.gbl...
I have a Repeater control in a web user control.

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

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

When I call PopulateRepeater 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 PopulateRepeater (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataSource = ds ' causes error "Object reference not set
to an instance of an object"
Repeater1.DataBind
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.PopulateRepeater

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
"ucUserControl1 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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OT**************@TK2MSFTNGP05.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**************@TK2MSFTNGP04.phx.gbl...
I have a Repeater control in a web user control.

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

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

When I call PopulateRepeater 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 PopulateRepeater (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataSource = ds ' causes error "Object reference not
set to an instance of an object"
Repeater1.DataBind
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*************@TK2MSFTNGP04.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.PopulateRepeater

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
"ucUserControl1 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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OT**************@TK2MSFTNGP05.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**************@TK2MSFTNGP04.phx.gbl...
I have a Repeater control in a web user control.

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

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

When I call PopulateRepeater 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 PopulateRepeater (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataSource = ds ' causes error "Object reference not
set to an instance of an object"
Repeater1.DataBind
Exit Sub




Apr 5 '06 #4
Thanks!

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Os**************@TK2MSFTNGP04.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*************@TK2MSFTNGP04.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.PopulateRepeater

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
"ucUserControl1 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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OT**************@TK2MSFTNGP05.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**************@TK2MSFTNGP04.phx.gbl...
I have a Repeater control in a web user control.

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

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

When I call PopulateRepeater 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 PopulateRepeater (iID as integer)
dim ds as DataSet = GetDataSet(iID)
Repeater1.DataSource = ds ' causes error "Object reference not
set to an instance of an object"
Repeater1.DataBind
Exit Sub




Apr 5 '06 #5

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

Similar topics

3
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...
5
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...
3
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...
1
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...
3
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> <%#...
8
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...
3
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...
7
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...
12
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.