Hello Developers,
I am developing an web application and i need to create report using reportveiewer.
I am successully able to fetch and display record in reportviewer now,
But if no record found then it will disply only header with all Fields.
Insted of this fields ,I want to Display Message "No Record Available".
Below is mail Sourccode that is working.
Report.aspx code:

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
            Font-Size="8pt" Height="400px" Width="100%">
            <LocalReport ReportPath="RegistrationReport.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" 
                        Name="RegistrationReport_MsdWebcast_GetRegisterUserTrainingEventsWise" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource  ID="ObjectDataSource1"  runat="server" SelectMethod="GetData" 
            OldValuesParameterFormatString="original_{0}" 
            TypeName="RegistrationReportTableAdapters.MsdWebcast_GetRegisterUserTrainingEventsWiseTableAdapter">
            <SelectParameters>
                <asp:QueryStringParameter  Name="TrainingEventsID" 
                    QueryStringField="TEID" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>

No extra code in Report.aspx.cs because of everthing is manage by aspx code that i mention above.


Please help.......
"Everthing that your Dynamic mind get is Possible :E=MC2"

Put oneLabel on your aspx page where you have dragged your report viewer control. Then check with your datasource.

I mean If (DataTable or DataSet.Tables["yourtablename/index"].Rows.Count == 0) then "Print message No recreds available" in Label.

Hope it will help you.

Hello Developers,
I am developing an web application and i need to create report using reportveiewer.
I am successully able to fetch and display record in reportviewer now,
But if no record found then it will disply only header with all Fields.
Insted of this fields ,I want to Display Message "No Record Available".
Below is mail Sourccode that is working.
Report.aspx code:

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
            Font-Size="8pt" Height="400px" Width="100%">
            <LocalReport ReportPath="RegistrationReport.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" 
                        Name="RegistrationReport_MsdWebcast_GetRegisterUserTrainingEventsWise" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource  ID="ObjectDataSource1"  runat="server" SelectMethod="GetData" 
            OldValuesParameterFormatString="original_{0}" 
            TypeName="RegistrationReportTableAdapters.MsdWebcast_GetRegisterUserTrainingEventsWiseTableAdapter">
            <SelectParameters>
                <asp:QueryStringParameter  Name="TrainingEventsID" 
                    QueryStringField="TEID" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>

No extra code in Report.aspx.cs because of everthing is manage by aspx code that i mention above.


Please help.......
"Everthing that your Dynamic mind get is Possible :E=MC2"

Put oneLabel on your aspx page where you have dragged your report viewer control. Then check with your datasource.

I mean If (DataTable or DataSet.Tables["yourtablename/index"].Rows.Count == 0) then "Print message No recreds available" in Label.

Hope it will help you.

How I can know the objectDataSource1 Contained records or not?

WIll you please provide code statement for that?

on aspx.cs page I need

on page load

if(Code to Is count Recourd values from objectDataSource1)
{
Response.Write("No Records Found");
Reportview1.visible=false;
}

Please Reply ,it's very urgent.
Thanks..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.