This is a migrated thread and some comments may be shown as answers.

Datasource/Binding Issue

7 Answers 184 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John Merritt
Top achievements
Rank 1
John Merritt asked on 26 Jan 2010, 03:48 PM
I'm passing a datatable as a property to a report and want to set it as the datasource. It appears to be working, but none of the data appears in the textboxes. For example:

Inside the report class...
--------------------
Private mSummaryData as DataTable

Public Property SummaryData() as DataTable
Set(ByVal pSummaryData as DataTable)
mSummaryData = pSummaryData
End Set
Get
Return mSummaryData
End Get
End Property

Private Sub Summary_ItemDataBinding(....)
Me.DataSource = mSummaryData
End Sub
-----------------------

It's possible I may not be formatting the fields properly. I've set a textbox on the report and set the value to "=LastName". Is there something I'm Missing?

Thanks!

7 Answers, 1 is accepted

Sort by
0
John Merritt
Top achievements
Rank 1
answered on 26 Jan 2010, 06:31 PM
I've since resolved the issue.
0
Saravanan
Top achievements
Rank 1
answered on 06 Jan 2011, 09:47 AM
Hello,
 I am also using the datasource as a property, when binding I do not get the values in the detail session. Can you share your experience.

Regards,
Saravanan.R
0
subbarayan
Top achievements
Rank 1
answered on 06 Jan 2011, 12:13 PM
hi am also having the same problem. sql datasource error.Unable to redrive the data from the sqlserver using sql datasource from the report.
help me.
0
Peter
Telerik team
answered on 11 Jan 2011, 02:36 PM
Hi,

This is a general problem, so please elaborate further on your exact scenario. In the concrete case the problem is in the way the datasource is set.

Private Sub Summary_ItemDataBinding(....)
    Me.DataSource = mSummaryData
End Sub

You had used the Definition item of the Report instead of the Processing one. The sender of the NeedDataSource event is always the processing counterpart of the data item and it is the receiver of the data source. The correct way is shown in the following code snippet:
Private Sub Summary_ItemDataBinding(....)
DirectCast(sender, Telerik.Reporting.Processing.Report).DataSource= _
mSummaryData
End Sub

Check out the following help articles:
Report Life Cycle
Understanding Events

Generally speaking our suggestion is to use our declarative DataSource components (ObjectDataSource) that we have introduced in Q1 2010. They are optimized for performance and no coding is required.

Greetings,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Saravanan
Top achievements
Rank 1
answered on 18 Jan 2011, 06:34 AM

Hello Peter,
                I am working on a asp.net application. I am trying to populate the report using the datasource. I am able to pass the values from 1 asp page to another only using Session or Cookies, when I try using the property it does not pass the value to other page or class file.  The session or cookies work for only asp.net pages.
                The “AlarmValues is a class that contains “GetAlarmInformation” (same as example) this function is a list from which the values are passed to the report to populate. “EntityListDataSource” is the source of information this value populates when bound to data grid.

 

Aspx page:
AlarmValues alrmRpt = new AlarmValues();
alrmRpt.TestDBValue = EntityListDataSource;
alrmRpt.ProptotNumOfAlarms = totNumOfAlarms;

AlarmValue Class:
private UIEntityList DBValueToPop;

 

public UIEntityList TestDBValue
{ 
    get 
    { 
        return DBValueToPop; 
    } 
    set 
    { 
        if (value != null) 
        { 
            DBValueToPop = value; 
            GetAlarmInformation(); 
        } 
    }
}
The report populates the values with the uncommented lines which are static values if we see for the commented lines “DBValueToPop” contains values from where the values are to be populated. I had checked and it says that “DBValueToPop” does not contain any value since values are not passed through the property.

 

        public List<AlarmInfo> GetAlarmInformation()
        {
            List<AlarmInfo> AlarmValue = new List<AlarmInfo>();
            //foreach (InitiatedAlarmUIEntity entity in DBValueToPop)
            //{
                AlarmValue.Add(new AlarmInfo()
                {
                    //StartTime = Convert.ToString(entity.StartTime),
                    //StopTime = Convert.ToString(entity.StopTime),
                    //AlarmCount = Convert.ToString(entity.AlarmCount),

                    StartTime = Convert.ToString(1),
                    StopTime = Convert.ToString(AssigntotNumOfAlarms),
                    AlarmCount = Convert.ToString(3)
                });
            //}                 
            return AlarmValue;
        } 

I am using object datasource. My doubt is that is the “AlarmValue” class gets created new when the report calls it and I need to supply values only as it calls since in the example the query and the connection is passed here.

0
Peter
Telerik team
answered on 20 Jan 2011, 05:31 PM
Hi Saravanan,

Reviewing the provided code snippets we are unable to find the cause for the unexpected behavior you have reported. We will appreciate if you open a support ticket and send us a runnable sample application that exhibits the issue. Once we debug it locally we will be able to advise you further.

Regards,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Saravanan
Top achievements
Rank 1
answered on 25 Jan 2011, 06:00 AM
Hello Peter,
I have attached the demo web application as per your request. Below is the ticket number.

Your ticket ID is: 387474

Thanks for the help.

Regards,
Saravanan
Tags
General Discussions
Asked by
John Merritt
Top achievements
Rank 1
Answers by
John Merritt
Top achievements
Rank 1
Saravanan
Top achievements
Rank 1
subbarayan
Top achievements
Rank 1
Peter
Telerik team
Share this question
or