Crystal Report Viewer is not showing?

  1. #1

    Crystal Report Viewer is not showing?

                    
     <Center MinHeight = "200">
                        <ext:Panel ID="SouthPanel" Height="150" AutoHeight="true" runat="server" Title="South" BodyStyle="padding:6px;">
                            <Body>
                                <table cellpadding="0" cellspacing="0" width="100%">
                                    <tr>
                                        <td>
                                            <CR:CrystalReportViewer ID="rptviewer" DisplayGroupTree="False" runat="server" AutoDataBind="true" />
                                        </td>
                                    </tr>
                                </table>
                            </Body>
                        </ext:Panel>
                    </Center>
    Please help. Crystal report viewer is not showing. Is there any error on the above code.

  2. #2

    RE: Crystal Report Viewer is not showing?

    Hi sadeque,

    Your code appears correct.

    Maybe remove the AutoHeight="true" from the Panel, although that shouldn't make a difference.
    Last edited by geoffrey.mcgill; Nov 10, 2011 at 3:41 PM.
    Geoffrey McGill
    Founder & CEO
  3. #3

    RE: Crystal Report Viewer is not showing?

     
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DailyAttendance.aspx.cs" Inherits="HRIS.Restricted.Report.DailyAttendance" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Register assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            var showResult = function(btn) {
                Ext.example.msg('Button Click', 'You clicked the {0} button', btn);
            };
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ScriptManager ID="ScriptManager1" runat="server" />
        
        <asp:SqlDataSource ID="SqlDataSourceEmployeeType" runat="server" ConnectionString="<%$ ConnectionStrings:HRISConnection %>"
            SelectCommand="SELECT vEmployeeTypeID, vEmployeeTypeName FROM EmployeeType">
        </asp:SqlDataSource>
        <ext:Store ID="StoreEmployeeType" runat="server" DataSourceID="SqlDataSourceEmployeeType">
            <Reader>
                <ext:JsonReader ReaderID="vEmployeeTypeID">
                    <Fields>
                        <ext:RecordField Name="vEmployeeTypeID" Type="String" Mapping="vEmployeeTypeID" />
                        <ext:RecordField Name="vEmployeeTypeName" Type="String" Mapping="vEmployeeTypeName" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <SortInfo Field="vEmployeeTypeName" Direction="ASC" />
            <Listeners>
                <LoadException Handler="Ext.Msg.alert('Employee Type - Load failed', e.message || e )" />
                <Load Handler="#{cmbEmployeeType}.setValue(#{cmbEmployeeType}.store.getAt(0).get('id'));" />
            </Listeners>
        </ext:Store>
        
        <asp:SqlDataSource ID="SqlDataSourceDepartment" runat="server" ConnectionString="<%$ ConnectionStrings:HRISConnection %>"
            SelectCommand="select vDepartmentID,vDepartmentName from DepartmentInfo">
        </asp:SqlDataSource>
        <ext:Store ID="StoreDepartment" runat="server" DataSourceID="SqlDataSourceDepartment">
            <Reader>
                <ext:JsonReader ReaderID="vDepartmentID">
                    <Fields>
                        <ext:RecordField Name="vDepartmentID" Type="String" Mapping="vDepartmentID" />
                        <ext:RecordField Name="vDepartmentName" Type="String" Mapping="vDepartmentName" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <SortInfo Field="vDepartmentName" Direction="ASC" />
            <Listeners>
                <LoadException Handler="Ext.Msg.alert('Employee Type - Load failed', e.message || e )" />
                <Load Handler="#{cmbDept}.setValue(#{cmbDept}.store.getAt(0).get('id'));" />
            </Listeners>
        </ext:Store>
    
        <asp:SqlDataSource ID="SqlDataSourceSection" runat="server" ConnectionString="<%$ ConnectionStrings:HRISConnection %>"
            SelectCommand="select vSectionID,vSectionName from SectionInfo">
        </asp:SqlDataSource>
        <ext:Store ID="StoreSection" runat="server" DataSourceID="SqlDataSourceSection">
            <Reader>
                <ext:JsonReader ReaderID="vSectionID">
                    <Fields>
                        <ext:RecordField Name="vSectionID" Type="String" Mapping="vSectionID" />
                        <ext:RecordField Name="vSectionName" Type="String" Mapping="vSectionName" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <SortInfo Field="vSectionName" Direction="ASC" />
            <Listeners>
                <LoadException Handler="Ext.Msg.alert('Employee Type - Load failed', e.message || e )" />
                <Load Handler="#{cmbSection}.setValue(#{cmbSection}.store.getAt(0).get('id'));" />
            </Listeners>
        </ext:Store>
        
        <asp:SqlDataSource ID="SqlDataSourceEmployeeID" runat="server" ConnectionString="<%$ ConnectionStrings:HRISConnection %>"
            SelectCommand="select vEmployeeID,vEmployeeManualID from EmployeePersonalInfo">
        </asp:SqlDataSource>
        <ext:Store ID="StoreEmployeeID" runat="server" DataSourceID="SqlDataSourceEmployeeID">
            <Reader>
                <ext:JsonReader ReaderID="vEmployeeID">
                    <Fields>
                        <ext:RecordField Name="vEmployeeID" Type="String" Mapping="vEmployeeID" />
                        <ext:RecordField Name="vEmployeeManualID" Type="String" Mapping="vEmployeeManualID" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <SortInfo Field="vEmployeeManualID" Direction="ASC" />
            <Listeners>
                <LoadException Handler="Ext.Msg.alert('Employee Type - Load failed', e.message || e )" />
                <Load Handler="#{cmbEmployeeID}.setValue(#{cmbEmployeeID}.store.getAt(0).get('id'));" />
            </Listeners>
        </ext:Store>
            
        <ext:ViewPort ID="ViewPort1" runat="server">
            <Body>
                <ext:BorderLayout ID="BorderLayout1" runat="server">
                    <North Collapsible="true" MinHeight="175" Split="true">
                        <ext:Panel ID="Panel1" runat="server" AutoHeight="true" FormGroup="true" ButtonAlign="Right"
                            BodyStyle="padding:5px;">
                            <Body>
                                <ext:FormLayout ID="FormLayout1" runat="server" LabelWidth="100">
                                    <ext:Anchor Horizontal="100%">
                                        <ext:MultiField ID="MultiField1" LabelStyle="font-size: 11px;" AutoWidth="true" runat="server"
                                            FieldLabel="Date">
                                            <Fields>
                                                <ext:DateField ID="dtAttendanceDate" Width="270" runat="server" />
                                                <ext:Label ID="Blank" EmptyText="" runat="server" />
                                            </Fields>
                                        </ext:MultiField>
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="100%">
                                        <ext:MultiField ID="MultiField2" LabelStyle="font-size: 11px;" AutoWidth="true" runat="server"
                                            FieldLabel="Employee Type">
                                            <Fields>
                                                <ext:ComboBox ID="cmbEmployeeType" StoreID="StoreEmployeeType" runat="server" Width="270"
                                                    Editable="true" DisplayField="vEmployeeTypeName" ValueField="vEmployeeTypeID"
                                                    TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" Select&#111;nfocus="true">
                                                </ext:ComboBox>
                                                <ext:Checkbox ID="chkEmployeeType" runat="server" LabelStyle="font-size: 11px;" BoxLabel="All" HideLabel="true">
                                                    <Listeners>
                                                        <Check Handler="
                                                            if(#{chkEmployeeType}.checked == true)
                                                            {
                                                                #{cmbEmployeeType}.setValue('All');
                                                                #{cmbEmployeeType}.disable();
                                                            }
                                                            else
                                                            {
                                                                #{cmbEmployeeType}.clearValue();
                                                                #{cmbEmployeeType}.enable();                                                            
                                                            }"/>
                                                    </Listeners>
                                                </ext:Checkbox>
                                            </Fields>
                                        </ext:MultiField>
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="100%">
                                        <ext:MultiField ID="MultiField3" LabelStyle="font-size: 11px;" AutoWidth="true" runat="server"
                                            FieldLabel="Department">
                                            <Fields>
                                                <ext:ComboBox ID="cmbDept" StoreID="StoreDepartment" runat="server" Width="270" Editable="true" 
                                                DisplayField="vDepartmentName" ValueField="vDepartmentID" TypeAhead="true" Mode="Local" 
                                                ForceSelection="true" TriggerAction="All" Select&#111;nfocus="true">
                                                    <SelectedItem Value="ID" />
                                                </ext:ComboBox>
                                                <ext:Checkbox ID="chkDept" runat="server" LabelStyle="font-size: 11px;" BoxLabel="All"
                                                    HideLabel="true" >
                                                    <Listeners>
                                                        <Check Handler="
                                                            if(#{chkDept}.checked == true)
                                                            {
                                                                #{cmbDept}.setValue('All');
                                                                #{cmbDept}.disable();
                                                            }
                                                            else
                                                            {
                                                                #{cmbDept}.clearValue();
                                                                #{cmbDept}.enable();                                                            
                                                            }"/>
                                                    </Listeners>
                                                    </ext:Checkbox>
                                            </Fields>
                                        </ext:MultiField>
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="100%">
                                        <ext:MultiField ID="MultiField4" LabelStyle="font-size: 11px;" AutoWidth="true" runat="server"
                                            FieldLabel="Section">
                                            <Fields>
                                                <ext:ComboBox ID="cmbSection" StoreID="StoreSection" runat="server" Width="270" Editable="true" 
                                                DisplayField="vSectionName" ValueField="vSectionID" TypeAhead="true" Mode="Local" 
                                                ForceSelection="true" TriggerAction="All" Select&#111;nfocus="true">
                                                    <SelectedItem Value="ID" />
                                                </ext:ComboBox>
                                                <ext:Checkbox ID="chkSection" runat="server" LabelStyle="font-size: 11px;" BoxLabel="All"
                                                    HideLabel="true" >
                                                    <Listeners>
                                                        <Check Handler="
                                                            if(#{chkSection}.checked == true)
                                                            {
                                                                #{cmbSection}.setValue('All');
                                                                #{cmbSection}.disable();
                                                            }
                                                            else
                                                            {
                                                                #{cmbSection}.clearValue();
                                                                #{cmbSection}.enable();                                                            
                                                            }"/>
                                                    </Listeners>
                                                    </ext:Checkbox>
                                            </Fields>
                                        </ext:MultiField>
                                    </ext:Anchor>
                                    <ext:Anchor Horizontal="100%">
                                        <ext:MultiField ID="MultiField5" LabelStyle="font-size: 11px;" AutoWidth="true" runat="server"
                                            FieldLabel="Employee ID">
                                            <Fields>
                                                <ext:ComboBox ID="cmbEmployeeID" StoreID="StoreEmployeeID" runat="server" Width="270" Editable="true" 
                                                DisplayField="vEmployeeManualID" ValueField="vEmployeeID" TypeAhead="true" Mode="Local" 
                                                ForceSelection="true" TriggerAction="All" Select&#111;nfocus="true">
                                                    <SelectedItem Value="ID" />
                                                </ext:ComboBox>
                                                <ext:Checkbox ID="chkEmployeeID" runat="server" LabelStyle="font-size: 11px;" BoxLabel="All"
                                                    HideLabel="true" >
                                                    <Listeners>
                                                        <Check Handler="
                                                            if(#{chkEmployeeID}.checked == true)
                                                            {
                                                                #{cmbEmployeeID}.setValue('All');
                                                                #{cmbEmployeeID}.disable();
                                                            }
                                                            else
                                                            {
                                                                #{cmbEmployeeID}.clearValue();
                                                                #{cmbEmployeeID}.enable();                                                            
                                                            }"/>
                                                    </Listeners>
                                                    </ext:Checkbox>
                                            </Fields>
                                        </ext:MultiField>
                                    </ext:Anchor>
                                </ext:FormLayout>
                            </Body>
                            <Buttons>
                                <ext:Button ID="btnPreview" runat="server" Text="Preview" Icon="PrinterConnect" >
                                    <AjaxEvents>
                                        <Click OnEvent="PreviewReport">
                                            <EventMask ShowMask="true" Msg="Generating Report. Please wait..."/>
                                        </Click>
                                    </AjaxEvents>
                                </ext:Button>
                                <ext:Button ID="btnPrint" runat="server" Text="Print" Icon="Printer" />
                            </Buttons>
                        </ext:Panel>
                    </North>
                    <Center>
                        <ext:Panel ID="SouthPanel" runat="server" Title="South" BodyStyle="padding:6px;">
                            <Body>
                                <table cellpadding="0" cellspacing="0" width="100%">
                                    <tr>
                                        <td>
                                            <CR:CrystalReportViewer ID="rptviewer" DisplayGroupTree="False" runat="server" AutoDataBind="true" />
                                        </td>
                                    </tr>
                                </table>
                            </Body>
                        </ext:Panel>
                    </Center>
                </ext:BorderLayout>
            </Body>
        </ext:ViewPort>
        </form>
    </body>
    </html>
    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.Data.SqlClient;
    using Coolite.Ext.Web;
    using System.IO;
    using System.Collections.Generic;
    using System.Net;
    using CrystalDecisions.CrystalReports.Engine;
    
    namespace HRIS.Restricted.Report
    {
        public partial class DailyAttendance : System.Web.UI.Page
        {
            ReportDocument report = new ReportDocument();
    
            protected void Page_Load(object sender, EventArgs e)
            {
                //string strParameter = "";
                //strParameter = @"select * from vwDailyAttendance order by vDepartmentID,vSectionID,vEmployeeID";
    
                //string connectionString = ConfigurationManager.ConnectionStrings["HRISConnection"].ConnectionString;
                //SqlConnection myConnection = new SqlConnection(connectionString);
                //SqlCommand myCommand = new SqlCommand(strParameter, myConnection);
                ////myCommand.Parameters.AddWithValue("@UserID", userID);
                //SqlDataAdapter ad = new SqlDataAdapter(myCommand);
                //DailyAttendanceDataSet DataSetDA = new DailyAttendanceDataSet();
                //ad.Fill(DataSetDA, "vwDailyAttendance");
    
                //report.FileName = Server.MapPath("rptDailyAttendance.rpt");
                //report.SetDataSource(DataSetDA);
                //rptviewer.ReportSource = report;
            }
    
            protected void PreviewReport(object sender, AjaxEventArgs e)
            {
                string strParameter = "";
                if (chkEmployeeType.Checked == false)
                {
                    strParameter = " vEmployeeTypeID = '" + cmbEmployeeType.SelectedItem.Value.ToString() + "' and ";
                }
                else
                {
                    strParameter += "";
                }
    
                if (chkDept.Checked == false)
                {
                    strParameter += " vDepartmentID = '" + cmbDept.SelectedItem.Value.ToString() + "' and ";
                }
                else
                {
                    strParameter += "";
                }
    
                if (chkSection.Checked == false)
                {
                    strParameter += " vSectionID = '" + cmbSection.SelectedItem.Value.ToString() + "' and ";
                }
                else
                {
                    strParameter += "";
                }
    
                if (chkEmployeeID.Checked == false)
                {
                    strParameter += " vEmployeeID = '" + cmbEmployeeID.SelectedItem.Value.ToString() + "' and ";
                }
                else
                {
                    strParameter += "";
                }
    
                //strParameter = "select * from vwRptDailyAttendance where " + strParameter + " order by vDepartmentID,vSectionID,vEmployeeID";
                strParameter = @"select * from vwDailyAttendance order by vDepartmentID,vSectionID,vEmployeeID";
    
                string connectionString = ConfigurationManager.ConnectionStrings["HRISConnection"].ConnectionString;
                SqlConnection myConnection = new SqlConnection(connectionString);
                SqlCommand myCommand = new SqlCommand(strParameter, myConnection);
                //myCommand.Parameters.AddWithValue("@UserID", userID);
                SqlDataAdapter ad = new SqlDataAdapter(myCommand);
                DailyAttendanceDataSet DataSetDA = new DailyAttendanceDataSet();
                ad.Fill(DataSetDA, "vwDailyAttendance");
    
                report.FileName = Server.MapPath("rptDailyAttendance.rpt");
                report.SetDataSource(DataSetDA);
                rptviewer.ReportSource = report;
                rptviewer.RefreshReport();
            }
    
        }
    }
    Please help me. It's not showing. showing blank in southPanel.


  4. #4

    RE: Crystal Report Viewer is not showing?

    Hi,

    You can't update none-Coolite controls during AjaxEvent. So, make any actions with report during initial page load or use postabck or UpdatePanel
    Vladimir Shcheglov
    Sr. Developer
  5. #5

    RE: Crystal Report Viewer is not showing?

    Hi,

    How can i update the UpdatePanel?

  6. #6
    the same problem in EXT.NET, not solved since 2009 ?
  7. #7
    Quote Originally Posted by cmujica View Post
    the same problem in EXT.NET, not solved since 2009 ?
    You can call .Update() on any non-Ext.NET Control to re-render that Control during a DirectEvent/DirectMethod.
    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. Replies: 3
    Last Post: Jan 09, 2012, 10:09 PM
  2. Crystal Report and Ext.net
    By sonlas7y20 in forum 1.x Help
    Replies: 7
    Last Post: Dec 29, 2011, 2:27 PM
  3. Custom Report Viewer
    By harinarayanan123 in forum 1.x Help
    Replies: 0
    Last Post: Aug 19, 2010, 10:47 AM
  4. Crystal Report Viewer Overlap
    By EzaBlade in forum 1.x Help
    Replies: 0
    Last Post: Sep 23, 2009, 1:26 PM
  5. How to add crystal report within panel
    By sadeque in forum 1.x Help
    Replies: 4
    Last Post: Jul 28, 2009, 5:57 AM

Posting Permissions