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

Repeater Access

I have a page with a Repeater control on it called Repeater1. On that page I
have a User Control I inserted using the HTML Method. Now I want to change
the Repeater's DataSource and then use DataBind method on it if a variable is
defined in the address bar. I've tried alot of things but so far no luck. The
main reason that I have the User Control is becuase it has all the database
controls (dbview, dataset, connection etc) and it also acts as a Menu that is
dynamicly generated based on a database query.

This Method Didn't work

This Function is in the WebForm1 where the Repeater is
public void RepeaterBinding(DataView dbDataViewSource)

{

Repeater1.DataSource = dbDataViewSource;

Repeater1.DataBind();

}


In the user control I tried doing this:

if(selectedcat != null)

{

string thefilter = "DownloadCategory= '"+selectedcat+"' ";

dbDataView.RowFilter = thefilter;

dbDataView.Table = dtDownloads;

DownloadScript.WebForm1 repeaterpage = new WebForm1();

repeaterpage.RepeaterBinding((DataView)this.dbData View);

Label1.Text = dbDataView.Table.Columns[0].ToString();

}
I get an error saying that there was no instance of an object.
Nov 18 '05 #1
1 1369
A line # would help, with the corresponding line (for all I know, you don't
have something called Label1).

I definately see 1 problem. In the user control, to get a reference to the
page, do this:

WebForm1 repeaterPage = (WebForm1)Page;

as opposed to try and create a new instance of the page..

Karl

"Unknown-Services" <Un**************@discussions.microsoft.com> wrote in
message news:9D**********************************@microsof t.com...
I have a page with a Repeater control on it called Repeater1. On that page I have a User Control I inserted using the HTML Method. Now I want to change
the Repeater's DataSource and then use DataBind method on it if a variable is defined in the address bar. I've tried alot of things but so far no luck. The main reason that I have the User Control is becuase it has all the database controls (dbview, dataset, connection etc) and it also acts as a Menu that is dynamicly generated based on a database query.

This Method Didn't work

This Function is in the WebForm1 where the Repeater is
public void RepeaterBinding(DataView dbDataViewSource)

{

Repeater1.DataSource = dbDataViewSource;

Repeater1.DataBind();

}


In the user control I tried doing this:

if(selectedcat != null)

{

string thefilter = "DownloadCategory= '"+selectedcat+"' ";

dbDataView.RowFilter = thefilter;

dbDataView.Table = dtDownloads;

DownloadScript.WebForm1 repeaterpage = new WebForm1();

repeaterpage.RepeaterBinding((DataView)this.dbData View);

Label1.Text = dbDataView.Table.Columns[0].ToString();

}
I get an error saying that there was no instance of an object.

Nov 18 '05 #2

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

Similar topics

1
by: Mark Fox | last post by:
Hello, I have a repeater and in each itemtemplate I have a radiobuttonlist. I am attempting to figure out how on postback I could iterate through the rows displayed by the repeater and for...
2
by: Thomas R | last post by:
Is is possible? In VS.NET 2003, Binding data to the repeater is easy, but when I try to add an ASP:checkbox to the .aspx page, the designer won't recognize it, hence the code view doesn't allow...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
7
by: Scott Schluer | last post by:
Hi All, I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a combination of a couple datagrids to...
8
by: darrel | last post by:
*sigh*...I've asked this before, but have long forgotten the answer. In the past, I'd often use repeater controls, bind data to it, and then reference the data fields from within the repeater: ...
3
by: sorCrer | last post by:
Hi All, Posted after extensive searching! I have a nested repeater control as follows: (Simplified ;-)) <table> <asp:repeater id=parent onItemDataBound=createChild> <tr><td>Level...
4
by: Joel | last post by:
Hey all- I'm new to asp.net so please bear with me -- I'm attempting to reference the repeater's Container.DataItem outside the repeater object. In other words -- In a seperate sub routine:...
1
by: jeremystein | last post by:
With nested repeaters, how can I access the outer repeater's DataItem from the inner repeater? Here's a snippet from my aspx: <asp:repeater id="OuterRepeater" runat="server"...
1
by: Jeremy | last post by:
Hello All, I have a Repeater which contains a Dynamic DropDownList within its itemtemplate. I know I have struggled with this before and I am pretty sure I had to save a bunch of crap manually...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.