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

RadAjaxLoadingPanel with cristal report

1 Answer 47 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
chandrasekaran
Top achievements
Rank 1
chandrasekaran asked on 17 Sep 2009, 05:00 AM
HI,
    i  am using telerik:RadAjaxLoadingPanel in the cristal report  page ,there report is not working in side the telerik:RadAjaxLoadingPanel .please any one help me
thanks
Chandruk

my code is

<

 

telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Transparency="30"

 

 

BackColor="#E0E0E0">

 

 

<asp:Image Style="margin-top: 10px" ID="Image1" runat="server" AlternateText="Loading..."

 

 

BorderWidth="0px" ImageUrl="~/images/loading.gif"></asp:Image>

 

 

</telerik:RadAjaxLoadingPanel>

 

 

<p class="caption">

 

 

<span>Search / List Contracts</span>

 

 

</p>

 

 

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1">

 

<

 

div class="boxbg aleft">

 

 

 

 

 

<p class="minicaption">

 

 

 

 

Search Criteria

 

</p>

 

 

 

 

 

<p class="note">

 

 

 

 

Enter Search Criteria and click Search button to list units. To list all units,

do not enter any search criteria.

 

</p>

 

 

 

 

 

<fieldset>

 

 

 

 

<%

-- ContractHolderName--%>

 

 

<label class="formlabel">

 

 

 

 

 

<span class="reqfld"></span>Contract Holder Name</label>

 

 

 

 

 

<telerik:RadComboBox ID="raddropdownlistContractHolder" runat="server" Width="300px"

 

 

 

 

 

Height="200px" Skin="Web20" DataTextField="Name" DataValueField="ID" AppendDataBoundItems="true"

 

 

 

 

 

EnableEmbeddedSkins="false" MarkFirstMatch="true">

 

 

 

 

 

</telerik:RadComboBox>

 

 

 

 

 

<br />

 

 

 

 

<%

-- Site Name--%>

 

 

<label class="formlabel">

 

 

 

 

 

<span class="reqfld"></span>Site Name</label>

 

 

 

 

 

<telerik:RadComboBox ID="raddropdownlistSiteName" runat="server" Width="300px" Height="200px"

 

 

 

 

 

Skin="Web20" DataTextField="Name" DataValueField="ID" AppendDataBoundItems="true"

 

 

 

 

 

EnableEmbeddedSkins="false" MarkFirstMatch="true">

 

 

 

 

 

</telerik:RadComboBox>

 

 

 

 

 

<br />

 

 

 

 

<%

--Specialty--%>

 

 

<label for="dropdownlistSpecialties" class="formlabel left">

 

 

 

 

Specialty

</label>

 

 

 

 

 

<telerik:RadComboBox ID="raddropdownlistSpecialties" runat="server" Width="300px"

 

 

 

 

 

Height="200px" Skin="Web20" DataTextField="DisplayName" DataValueField="DisplayID"

 

 

 

 

 

AppendDataBoundItems="true" EnableEmbeddedSkins="false" MarkFirstMatch="true">

 

 

 

 

 

</telerik:RadComboBox>

 

 

 

 

 

<br />

 

 

 

 

<%

--Skills--%>

 

 

<label for="dropdownlistSkills" class="formlabel left">

 

 

 

 

Skills

</label>

 

 

 

 

 

<telerik:RadComboBox ID="raddropdownlistSkills" runat="server" Width="300px" Height="200px"

 

 

 

 

 

Skin="Web20" DataTextField="DisplayName" DataValueField="DisplayID" AppendDataBoundItems="true"

 

 

 

 

 

EnableEmbeddedSkins="false" MarkFirstMatch="true">

 

 

 

 

 

</telerik:RadComboBox>

 

 

 

 

<%

--Report Type--%>

 

 

<label for="dropdownlistSkills" class="formlabel left">

 

 

 

 

Create Report as

</label>

 

 

 

 

 

<asp:RadioButtonList ID="radioReport" runat="server" CssClass="formlabel1" RepeatDirection="Horizontal">

 

 

 

 

 

<asp:ListItem Text="Adobe PDF" Value="pdf" Selected></asp:ListItem>

 

 

 

 

 

<asp:ListItem Text="Microsoft Excel" Value="xls"></asp:ListItem>

 

 

 

 

 

</asp:RadioButtonList>

 

 

 

 

 

</fieldset>

 

 

 

 

 

</div>

 

 

 

 

 

<div class="btnpnl">

 

 

 

 

 

<asp:ImageButton ID="buttonReport" runat="server" CausesValidation="false" OnClick="buttonReport_Click"

 

 

 

 

 

AlternateText="Report" ImageUrl="~/Images/report_btn.gif" OnClientClick="Javascript:Auto() ;" />

 

 

 

 

 

</div>

 

 

</telerik:RadAjaxPanel>

 

 

protected void buttonReport_Click(object sender, EventArgs e)

 

{

 

try

 

 

 

 

{

 

// this.FillBusinessObjects();

 

 

 

 

 

//IList<ClinicalUnit> clinicalUnits = ReportController.RetrieveUnitReportForSearchData();

 

 

 

 

 

// radgridUnits.DataSource = clinicalUnits;

 

 

 

 

 

// radgridUnits.DataBind();

 

 

 

 

 

 

DataSet dataSetUnit = new DataSet();

 

 

DataTable dataTableUnit = ConstructDataTableUnit();

 

 

this.FillBusinessObjects();

 

 

IList<ClinicalUnit> clinicalUnits = ReportController.RetrieveUnitReportForSearchData();

 

 

//radgridUnits.DataSource = clinicalUnits;

 

 

 

 

 

//radgridUnits.DataBind();

 

 

 

 

 

if (clinicalUnits.Count > 0)

 

{

 

for (int i = 0; i < clinicalUnits.Count; i++)

 

{

 

DataRow dataRowUnit = dataTableUnit.NewRow();

 

dataRowUnit[

"UnitID"] = clinicalUnits[i].ID.ToString();

 

dataRowUnit[

"UnitName"] = clinicalUnits[i].Name.ToString();

 

dataRowUnit[

"SiteName"] = clinicalUnits[i].Site.Name.ToString();

 

dataRowUnit[

"Status"] = clinicalUnits[i].StatusText.ToString();

 

dataRowUnit[

"Specialty"] = clinicalUnits[i].Specialty.Name.ToString();

 

dataRowUnit[

"Skills"] = clinicalUnits[i].Skill.Name.ToString();

 

dataRowUnit[

"Population"] = clinicalUnits[i].Population.Name.ToString();

 

dataRowUnit[

"AcceptGrad"] = clinicalUnits[i].IsGraduationText.ToString();

 

dataRowUnit[

"AcceptUnderGraduation"] = clinicalUnits[i].IsUnderGraduationText.ToString();

 

dataRowUnit[

"ServiceLearning"] = clinicalUnits[i].IsServiceLearningText.ToString();

 

dataRowUnit[

"NoOfStudents"] = clinicalUnits[i].NoOfStudent.ToString();

 

dataRowUnit[

"UnitContactName"] = clinicalUnits[i].ContactFirstName.ToString();

 

dataRowUnit[

"UnitContactPhone"] = clinicalUnits[i].ContactPhone.ToString();

 

dataRowUnit[

"UnitContactEmail"] = clinicalUnits[i].ContactEMail.ToString();

 

dataTableUnit.Rows.Add(dataRowUnit);

}

dataSetUnit.Tables.Add(dataTableUnit);

ExportReport(dataSetUnit);

}

 

else

 

 

 

 

ClientScript.RegisterStartupScript(

this.GetType(), "onclick", "<script language='javascript'>alert('No Records Found');</script>");

 

 

}

 

catch (SofturaException softuraException)

 

{

 

// throw softuraException;

 

 

 

 

}

 

catch (Exception exception)

 

{

 

// throw exception;

 

 

 

 

}

}

 

private DataTable ConstructDataTableUnit()

 

{

 

DataTable dtUnit = new DataTable("dataTableUnit");

 

dtUnit.Columns.Add(

"UnitID");

 

dtUnit.Columns.Add(

"UnitName");

 

dtUnit.Columns.Add(

"SiteName");

 

dtUnit.Columns.Add(

"Status");

 

dtUnit.Columns.Add(

"Specialty");

 

dtUnit.Columns.Add(

"Skills");

 

dtUnit.Columns.Add(

"Population");

 

dtUnit.Columns.Add(

"AcceptGrad");

 

dtUnit.Columns.Add(

"AcceptUnderGraduation");

 

dtUnit.Columns.Add(

"ServiceLearning");

 

dtUnit.Columns.Add(

"NoOfStudents");

 

dtUnit.Columns.Add(

"UnitContactName");

 

dtUnit.Columns.Add(

"UnitContactPhone");

 

dtUnit.Columns.Add(

"UnitContactEmail");

 

 

return dtUnit;

 

}

 

private void ExportReport(DataSet dataSetUnit)

 

{

 

string sReportType = radioReport.SelectedValue;

 

 

UnitReportXSD objUnits = new UnitReportXSD();

 

objUnits.Merge(dataSetUnit);

 

ReportDocument rdUnits = new ReportDocument();

 

rdUnits.Load(Server.MapPath(

"UnitReport.rpt"));

 

 

ExportOptions expOpt = new ExportOptions();

 

 

DiskFileDestinationOptions dskOpt = new DiskFileDestinationOptions();

 

rdUnits.SetDataSource(objUnits);

 

string sBaseURL = Request.PhysicalApplicationPath.ToString() + ConfigurationSettings.AppSettings["UnitReportPath"].ToString();

 

 

//FileInfo fileInfo = new FileInfo(sBaseURL + "UnitReport.xls");

 

 

 

 

 

FileInfo fileInfo = new FileInfo(sBaseURL + "UnitReport." + sReportType);

 

fileInfo.IsReadOnly =

false;

 

 

//dskOpt.DiskFileName = sBaseURL + "UnitReport.xls";

 

 

 

 

dskOpt.DiskFileName = sBaseURL +

"UnitReport." + sReportType;

 

expOpt = rdUnits.ExportOptions;

expOpt.ExportDestinationOptions = dskOpt;

expOpt.ExportDestinationType =

ExportDestinationType.DiskFile;

 

 

if (sReportType.ToUpper().Equals("PDF"))

 

expOpt.ExportFormatType =

ExportFormatType.PortableDocFormat;

 

 

else

 

 

 

 

expOpt.ExportFormatType =

ExportFormatType.Excel;

 

rdUnits.Export();

DownloadReport(sReportType);

}

 

private void DownloadReport(string sReportType)

 

{

 

try

 

 

 

 

{

 

string sBaseURL = Request.PhysicalApplicationPath.ToString() + "Units\\UnitReport." + sReportType;

 

Response.ClearHeaders();

Response.AddHeader(

"content-disposition", "attachment; filename=UnitReport." + sReportType);

 

 

if (sReportType.ToUpper().Equals("PDF"))

 

Response.ContentType =

"application/force-download";

 

 

else

 

 

 

 

Response.ContentType =

"application/vnd.ms-excel";

 

Response.WriteFile(sBaseURL);

Response.End();

}

 

catch (Exception ex)

 

{

 

throw new Exception(ex.Message);

 

}

}

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 18 Sep 2009, 08:16 AM
Hi chandrasekaran,

How to us CrystalReportViewer with RadAjax you can see from the code library project pointed below:
http://www.telerik.com/community/code-library/aspnet-ajax/ajax/using-crystalreportviewer-with-radajax.aspx 

Review the implementation from the sample for more details.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Ajax
Asked by
chandrasekaran
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or