• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 808
  • Last Modified:

Cannot set DataSource for nested Repeater

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.

Help!!
0
mattfox77
Asked:
mattfox77
  • 3
  • 2
1 Solution
 
Anurag ThakurTechnical ManagerCommented:
0
 
mattfox77Author Commented:
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
        {
            get
            {
                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

0
 
mattfox77Author Commented:
ragi0017:
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!

0
 
Anurag ThakurTechnical ManagerCommented:
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
0
 
mattfox77Author Commented:
That's it!  I changed it to:
allActs = JobActLogic.GetJobActivities(JobID);
and it works!
thank you!

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now