Cannot set DataSource for nested Repeater

Posted on 2008-11-08
Medium Priority
Last Modified: 2013-12-17
I am trying to create a nested repeater that uses the same BLL layer as the parent repeater.
I have a method which retrieves the data for the nested repeater based on the value of a field retrieved from the parent repeater by a button.
When the repeaters are separated everything works fine - the ItemCommand event of the parent repeater sends the value to the method and the child repeater(not nested) retrieves the correct data.  However when I move the child repeater inside the parent repeater,  Visual Studio complains that the repeater doesn't exist in the current context - intellisense doesn't recognize the child repeater or DataSource for it.

Question by:mattfox77
  • 3
  • 2
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22915006

Author Comment

ID: 22915057
I've amended my code to build the nested repeater datasource with a method,  but now I am getting an error on compile:

Error      6      No overload for method 'GetJobActivities' takes '0' arguments      

the method refers to a method in the BLL  which calls a tableadapter in the DAL

Code Behind:
protected JobActivities.taJobActivitiesDataTable allActs = null;
        protected JobActivities.taJobActivitiesDataTable GetJobActivities(string JobID)
            if(allActs == null)
            JobsBLL JobActLogic = new JobsBLL();
            allActs = JobActLogic.GetJobActivities();
            allActs.DefaultView.RowFilter = "Job_CD = " + JobID;
            return allActs;
Nested Repeater DataSource:
<asp:Repeater ID="repeaterChild" runat="server" DataSource='<%# GetJobActivities((string) Eval("Job_Cd")) %>' >
BLL Class Method:
 private taJobActivitiesTableAdapter _jobsAdapter = null;
        protected taJobActivitiesTableAdapter jAdapter
                if (_jobsAdapter == null)
                    _jobsAdapter = new taJobActivitiesTableAdapter();
                return _jobsAdapter;
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
        public JobActivities.taJobActivitiesDataTable GetJobActivities(string JobID)
            return jAdapter.GetJobActivities(JobID);

Open in new window


Author Comment

ID: 22915062
I've read through the codeproject code you posted,  as well as many others similar - I'm not declaring my datasources in the code - Im using a 3 tier architecture,  and when I did try to use the example code,  I could not define the datasource for the nested repeater!! Im missing maybe a declaritive or something??
Anyway,  now Ive got it down to a method (previous attempts at this would not work but Im trying again anyway)  -got to get past the 0 arguments error!

LVL 26

Accepted Solution

Anurag Thakur earned 1500 total points
ID: 22915104
i am thinking that the error is not coming from your repeater but from the following line

allActs = JobActLogic.GetJobActivities();
i am saying so becasuse GetJobActivities always takes a parameter for jobid

Author Closing Comment

ID: 31514758
That's it!  I changed it to:
allActs = JobActLogic.GetJobActivities(JobID);
and it works!
thank you!


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question