or
public static List<ALERT> Load() { List<ALERT> myList = new List<ALERT>(); AlertServices.AlertServiceClient AlertClient = new AlertServices.AlertServiceClient(); AlertClient.ClientCredentials.UserName.UserName = "usrName"; AlertClient.ClientCredentials.UserName.Password = "password"; ALERT[] dtAlerts = AlertClient.getAllAlerts(); foreach (ALERT alrt in dtAlerts ) { myList.Add(alrt); } AlertClient.Close(); return myList; }An error has occurred while processing Report 'AllAlerts': Exception has been thrown by the target of an invocation. ------------- InnerException ------------- Could not find default endpoint element that references contract 'AlertServices.IAlertService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element. Telerik Reporting v5.0 trial version. Copyright Telerik © 2002-2011. To remove this message, please obtain a commercial version from www.telerik.com <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <bindings> <wsHttpBinding> <binding name="wsHttpAlrEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="1024000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="http://muaath.local/TRDWCFSurv/TRDWCFSurvServices.AlertService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpAlrEndpoint" contract="AlertServices.IAlertService" name="wsHttpAlrEndpoint"> <identity> <certificate encodedValue="AwAAAAEAAAAUAAAAxtusZ48yxeG84lIeb9af1Wg7ib8gAAAAAQAAAMwBAAAwggHIMIIBNaADAgECAhDGybGTRx4Fg0xdc1+CAK0SMAkGBSsOAwIdBQAwETEPMA0GA1UEAxMGSWRDZXJ0MCAXDTEwMDMyNDEyMDI1MloYDzQwMDgxMTI0MTIwMjUyWjARMQ8wDQYDVQQDEwZJZENlcnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKl6oADCxSKQ+isZMfBzjafbEDPmE9Hn6yStKCoXjGlskH5Yqmwp7q4hrLbPmJT7iE4NEtmtJ9MCmXxJuGJuT8mgVadzAHNFnlHCG0DhdZJrg4tSe+vOo0yYVq96zMH6I8QCLyALBS15bdWcG0QpOa5mm6ZeO9hp23cYwJhgeHiPAgMBAAGjJzAlMBMGA1UdJQQMMAoGCCsGAQUFBwMBMA4GA1UdDwQHAwUAsAAAADAJBgUrDgMCHQUAA4GBAEGNLlMfqLpAx8fg35D/NVZIbE2psK2M7BgiTOd/KFgYTbiWT/I7zfPlcQ1DFQ59NtuVbODVsTCZQdmmNr6iZIEnEBsdfsdfjsdfjklsdf78sdjfkjsdklf8Y4XXNQMpIcjcTK+dpM6KcnK4ocmLhXzLbgKcR5YUWmsdxSdt" /> </identity> </endpoint> </client> </system.serviceModel> </configuration>var report = new TestReport(); var ods = new Telerik.Reporting.ObjectDataSource(); ods.DataSource = instanceOfFoo; report.DataSource = ods; instanceReportSource.ReportDocument = report; ReportViewer.ReportSource = instanceReportSource;
public static string ReturnRiskLeveltext(int rId){ using (DataEntities ctx = new DataEntities()) { var RiskLevel = ctx.RiskLevels.Where(x => x.RiskLevelID == rId).SingleOrDefault(); return RiskLevel.Level; }}= Avg(Fields.RiskLevel)= ReturnRiskLeveltext(Avg(Fields.RiskLevel))http://www.telerik.com/community/forums/aspnet-ajax/grid/exporting-without-bom.aspx#1474434
Code:
viewer.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="viewer.aspx.cs" Inherits="Panda.Web.App.Reports.Repository.Viewer" %><%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=6.0.12.215, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %><!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> <link type="text/css" rel="stylesheet" href="~/Styles/reset.css" /> <style type="text/css"> html#html, body#body, form#form1, div#content { height: 100%; } </style></head><body id="body"> <form id="form1" runat="server"> <div id="content"> <telerik:reportviewer Id="ReportViewer1" runat="server" Width="100%" Height="790px" ShowDocumentMapButton="False" ShowHistoryButtons="False" ShowPrintPreviewButton="False" Skin="WebBlue" ViewMode="PrintPreview" ZoomPercent="50"></telerik:reportviewer> </div> </form></body></html>var reportDefinitionFile = Server.MapPath("~/app/reports/repository/rpt/" + _reportPath);using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(reportDefinitionFile)){ System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(Telerik.Reporting.Report)); Telerik.Reporting.Report reportDocument = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader); var conn = WebConfigurationManager.ConnectionStrings["Panda.Data.ConnectionString"]; if (conn == null) { conn = WebConfigurationManager.ConnectionStrings["Panda.Data." + Environment.MachineName + ".ConnectionString"]; } var connString = conn.ConnectionString; // Set Report datasource connections for report, parameters and all other objects var sds = (Telerik.Reporting.SqlDataSource)reportDocument.DataSource; sds.ConnectionString = connString; // parameters foreach (var obj in reportDocument.ReportParameters) { if (obj.AvailableValues.DataSource != null) { var ds = (Telerik.Reporting.SqlDataSource)obj.AvailableValues.DataSource; ds.ConnectionString = connString; } } ////// other report objects //SetConnectionStrings(reportDocument.Items, connString); ReportViewer1.Report = reportDocument; ReportViewer1.DataBind(); ReportViewer1.RefreshReport();}
Settings.trdx
<?xml version="1.0" encoding="utf-8"?>
<Report Width="10.45833333in" DocumentName="Panda Settings|List of global properties" Name="Settings">
<DataSources>
<SqlDataSource ConnectionString="Server=***\***;Database=***;uid=***;pwd=****;" SelectCommand="Select * from PandaSetting" Name="Panda" />
</DataSources>
<PageSettings PaperKind="Letter" Landscape="True">
<Margins Left="0.25in" Right="0.25in" Top="0.25in" Bottom="0.25in" />
</PageSettings>
<DataSourceRef>Panda</DataSourceRef>
<StyleSheet>
<StyleRule>
<Style BackgroundColor="" Color="28, 58, 112">
<Font Name="Tahoma" Size="18pt" Style="Regular" />
</Style>
<Selectors>
<StyleSelector>
<Type>ReportItemBase</Type>
<StyleName>Title</StyleName>
</StyleSelector>
</Selectors>
</StyleRule>
<StyleRule>
<Style BackgroundColor="28, 58, 112" Color="White" VerticalAlign="Middle">
<Font Name="Tahoma" Size="11pt" Style="Bold" />
</Style>
<Selectors>
<StyleSelector>
<Type>ReportItemBase</Type>
<StyleName>Caption</StyleName>
</StyleSelector>
</Selectors>
</StyleRule>
<StyleRule>
<Style Color="Black" VerticalAlign="Middle">
<Font Name="Tahoma" Size="10pt" Style="Regular" />
</Style>
<Selectors>
<StyleSelector>
<Type>ReportItemBase</Type>
<StyleName>Data</StyleName>
</StyleSelector>
</Selectors>
</StyleRule>
<StyleRule>
<Style Color="Black" VerticalAlign="Middle">
<Font Name="Tahoma" Size="8pt" Style="Regular" />
</Style>
<Selectors>
<StyleSelector>
<Type>ReportItemBase</Type>
<StyleName>PageInfo</StyleName>
</StyleSelector>
</Selectors>
</StyleRule>
</StyleSheet>
<Groups>
<Group Name="labelsGroup">
<GroupHeader>
<GroupHeaderSection PrintOnEveryPage="True" Height="0.28125in" Name="labelsGroupHeader">
<Items>
<TextBox Value="name" CanGrow="True" Left="0.02083333in" Top="0.02083333in" Width="5.19791667in" Height="0.20000001in" Name="nameCaptionTextBox" StyleName="Caption" />
<TextBox Value="description" Angle="0" CanGrow="True" Left="5.23958333in" Top="0.02083333in" Width="4.46041679in" Height="0.20000001in" Name="descriptionCaptionTextBox" StyleName="Caption" />
</Items>
</GroupHeaderSection>
</GroupHeader>
<GroupFooter>
<GroupFooterSection Height="0.28125in" Name="labelsGroupFooter">
<Style Visible="False" />
</GroupFooterSection>
</GroupFooter>
</Group>
</Groups>
<Items>
<PageHeaderSection Height="0.28125in" Name="pageHeader">
<Style>
<BorderStyle Default="Solid" />
</Style>
</PageHeaderSection>
<PageFooterSection Height="0.28125in" Name="pageFooter">
<Items>
<TextBox Value="=NOW()" Left="0.02083333in" Top="0.02083333in" Width="5.19791667in" Height="0.20000001in" Name="currentTimeTextBox" StyleName="PageInfo" />
<TextBox Value="=PageNumber" Left="5.23958333in" Top="0.02083333in" Width="5.19791667in" Height="0.20000001in" Name="pageInfoTextBox" StyleName="PageInfo">
<Style TextAlign="Right" />
</TextBox>
</Items>
</PageFooterSection>
<ReportHeaderSection Height="0.80823493in" Name="reportHeader">
<Items>
<TextBox Value="Panda Settings" Left="0in" Top="0in" Width="10.45833333in" Height="0.7874016in" Name="titleTextBox" StyleName="Title" />
</Items>
</ReportHeaderSection>
<ReportFooterSection Height="0.28125in" Name="reportFooter" />
<DetailSection Height="0.28125in" Name="detail">
<Items>
<TextBox Value="=Fields.name" CanGrow="True" Left="0.02083333in" Top="0.02083333in" Width="5.19791667in" Height="0.20000001in" Name="nameDataTextBox" StyleName="Data" />
<TextBox Value="=Fields.description" Angle="0" CanGrow="True" Left="5.23958333in" Top="0.02083333in" Width="4.46041679in" Height="0.20000001in" Name="descriptionDataTextBox" StyleName="Data" />
</Items>
</DetailSection>
</Items>
</Report>
Where am I going wrong? <telerik:ReportViewer ID="ReportViewer1" runat="server" Height="500px" Width="100%"> <typereportsource typename="ETRrpts.IndividualSummary, ETRrpts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"></typereportsource> </telerik:ReportViewer>