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

Telerik Trainer Bind to Data Programatically

4 Answers 175 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Eugene
Top achievements
Rank 1
Eugene asked on 29 Jul 2008, 07:34 AM
I followed the Telerik Trainer Bind to Data Programatically portion and I cannot get get the report working. After following the steps, set up my datasource, and put my textboxes. When go and preview the report, it give me the msg 'The source of the report definition has not been specified'. How do I solve this?

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 29 Jul 2008, 08:37 AM
Hi Eugene,

The only reason for your report not to work is missing DataSource property setting - please set the DataSource property of the report trough VS2005 Designer and let us know of the outcome. You can also check your connection string and make sure it is correct and returns proper data. Try running it in your app directly without using preview and see if that works.

Kind regards,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Eugene
Top achievements
Rank 1
answered on 29 Jul 2008, 08:51 AM

Hi Steve,

Below is my code file for my report. On the report design, I just put one textbox with the expression '=Fields.Name'. When I preview I get the error msg. When you mentioned about the data source property, I am assuming that the code below is what you mean by data source property. This is all that I did in trying to come out with the Binding to Data Programatically. Please advice.

public partial class NTierUsersReport : Report
    {
        public NTierUsersReport()
        {
            /// <summary>
            /// Required for telerik Reporting designer support
            /// </summary>
            InitializeComponent();

            // Create connection, command adapter
            SqlConnection sqlConnection1 = new SqlConnection();
            SqlCommand sqlSelectCommand1 = new SqlCommand();
            SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter();
            // define a connection string
            sqlConnection1.ConnectionString =
                "Data Source=DEV1;Initial Catalog=TestApplicationDB;Integrated Security=True;";
            // define the command object properties
            sqlSelectCommand1.CommandText = "SELECT Name FROM Users";
            sqlSelectCommand1.Connection = sqlConnection1;
            sqlDataAdapter1.SelectCommand = sqlSelectCommand1;
            this.DataSource = sqlDataAdapter1;
        }
    }

Regards,
Eugene

0
pcrane
Top achievements
Rank 1
answered on 11 Feb 2009, 06:02 PM
I'm getting the same error.  I set up two date parameters and when the report runs I get the error. If I then press the preview button the data will come back just fine.

Hitting the preview button doesn't post back so I'm wondering why I get this error the first time.

Also, is there a way to capture the event when the preview button is being pressed?  I need to post back to the server with the new dates.  I am using an Oracle Package as the datasource.
0
Accepted
Steve
Telerik team
answered on 12 Feb 2009, 09:58 AM
Hello pcrane,

Currently the parameter area is in iframe and that is why postback is not observed, since it is in the context of a "separate" page. The viewer handles the information through the http handler that is defined in the web/app config file. Please verify that you have default values for the parameters set and that your filter expression is valid.
If you are following Telerik Trainer video, please use the code view to directly open the project in Visual Studio and pinpoint the differences.

Regards,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Eugene
Top achievements
Rank 1
Answers by
Steve
Telerik team
Eugene
Top achievements
Rank 1
pcrane
Top achievements
Rank 1
Share this question
or