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

Print Message when Subreport has no Record

4 Answers 184 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ajay
Top achievements
Rank 1
Ajay asked on 16 Jan 2013, 09:50 AM
Hi,

I need to display "No Record Found" Message in Section of Parent report when subreport has no record to display.

Please suggest what to do ??

Thanks...

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 16 Jan 2013, 10:05 AM
Hi Ajay,

There is no out of the box way to show "No Record Found" message. You would have to check the data source for the SubReport and if there aren't any records, set desired "No Records" message to a label TextBox. See the following blog post for a possible approach to accomplish this.

Kind regards,
Steve
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Ajay
Top achievements
Rank 1
answered on 17 Jan 2013, 04:48 AM
Hi  Steve,

Thanks for reply,

I have tried this solution before posting question..

This is My Code for Hide/Show message

private void subrptClass_ItemDataBound(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.SubReport subReport = (Telerik.Reporting.Processing.SubReport)sender;
            subReport.Visible = subReport.ChildElements.Find("TextBox16", true).Length > 0;
            textBox2.Visible = !subReport.Visible;
        }

This works fine to hide subreport But textBox not get Visible..
If I've check textBox value is Set as per Last Record.
means..   if two record then in first textbox is visible true, and by second record it be visible false then it will visible false for every subReport.

How to Make Textbox visible when subreport has No Value ???




0
Accepted
Stef
Telerik team
answered on 22 Jan 2013, 08:32 AM
Hi Ajay,

The approach that my colleague has suggested is valid and I have attached two reports which work as expected (ApproachfromBlog.zip).
Another approach is to use a textBox item in the detail report with visibility bound to an expression checking if Count(1)=0 (if there is data), and displaying text from within the subReport item as 'No data'. Other suggestion is illustrated in the attached reports, based on the same approach. Please notice that we work with processing elements.

Greetings,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Ajay
Top achievements
Rank 1
answered on 25 Jan 2013, 11:10 AM
Thanks for reply.

I have got my solution by your answer..
Tags
General Discussions
Asked by
Ajay
Top achievements
Rank 1
Answers by
Steve
Telerik team
Ajay
Top achievements
Rank 1
Stef
Telerik team
Share this question
or