Telerik Forums
Reporting Forum
4 answers
549 views

I'm trying to make a textbox in the footer the difference of two textbox value.

One is a sum value of a data item, the other is a value generated via codebehind.

 

I've tried this:

Private Sub ReportFooterSection1_ItemDataBound(sender As Object, e As EventArgs) Handles ReportFooterSection1.ItemDataBound
        oConn.Open()
        Dim ocmd As New SqlCommand("SELECT * FROM tblDynamic", oConn)
        ocmd.CommandType = SqlDataSourceCommandType.Text
        Dim reader As SqlDataReader
        reader = ocmd.ExecuteReader
        If reader.HasRows Then
            reader.Read()
            _txtLoansPerFinancial.Value = reader("TotalLoansPerFinancials").ToString()
            _txtLoanDifference.Value = _txtLoansPerFinancial.Value - _txtTotalLoanBalance.Value
        End If
        oConn.Close()
    End Sub

 

Where the expression on _txtTotalLoanBalance is = Sum(Fields.PctRiskTierGT1) , however rather than get the value that the expression brings, it incorporates _txtTotalLoanBalance.value as the string "= Sum(Fields.PctRiskTierGT1)" and it gets an error.

 

How can I get the value of this text box, or the value of Sum(Fields.PctRiskTierGT1) in the codebehind?

Ryan
Top achievements
Rank 1
 answered on 06 Jul 2017
3 answers
165 views

Hello all reporting gurus.

I've been using Telerik reporting in Silverlight for 5 years, acctually with no serious issue.

Now we need to send a report via Mail w/o passing thru printing it to pdf and manually attaching it to a mail. So I've googled a little and found a way thru RepoerRender. The problem is that I'm NOT able to pass any parameter (all I get is a page with just fixed fields and DataSource is not used anytime (I have a breakpoint in report's rptPraticaPreventivo_NeedDataSource event, and it's never hit), so I guess I'm doing it the wrong way.

Can you pls help me in passing parameters the right way?

code I'm using is right after (both in VB and C#). Thank you in advance!

 

======================================VisualBasic=======================================================

    Public Sub SendByMail(nomeRpt As String, parList As String, codTesti As String, adresses As String, sender As String, subj As String, body As String, mailPwd As String)

        Dim rptSrc As New InstanceReportSource()
        Dim exRpt = Assembly.GetExecutingAssembly
        Dim tcw As Type = Type.GetType("UGO_Rpt." + nomeRpt)
        Dim rp As New rptPraticaPreventivo
        Dim pars() As String = parList.Split(";")
        For Each par In pars
            Dim idVal() = par.Split("=")
            Dim id As String = idVal(0)
            Dim val As String = idVal(1)
            rptSrc.Parameters.Add(id, val)
        Next
        rptSrc.ReportDocument = rp
        Dim rpt = TryCast(rp, Telerik.Reporting.Report)

        Dim reportProcessor As New ReportProcessor()
        Dim result As RenderingResult = reportProcessor.RenderReport("PDF", rpt, Nothing)

        Dim ms As New MemoryStream(result.DocumentBytes)
        ms.Position = 0

        Dim attachment As New Attachment(ms, rpt.Name + ".pdf")
        Dim msg As New MailMessage(sender, adresses, subj, body)
        msg.ReplyToList.Add(sender)
        msg.Attachments.Add(attachment)
        Dim SmtpServer As New System.Net.Mail.SmtpClient()
        Dim netCred As New NetworkCredential
        netCred.UserName = "security@mydomain.com"
        netCred.Password = mailPwd
        SmtpServer.Credentials = netCred
        SmtpServer.Port = 587 'Porta standard SMTP/TSL
        SmtpServer.Host = "name.server.com"
        SmtpServer.SendMailAsync(msg)
    End Sub

========================================C#===========================================================

public void SendByMail(string nomeRpt, string parList, string codTesti, string adresses, string sender, string subj, string body, string mailPwd)
{
InstanceReportSource rptSrc = new InstanceReportSource();
dynamic exRpt = Assembly.GetExecutingAssembly;
Type tcw = Type.GetType("UGO_Rpt." + nomeRpt);
rptPraticaPreventivo rp = new rptPraticaPreventivo();
string[] pars = parList.Split(";");
foreach (void par_loopVariable in pars) {
par = par_loopVariable;
[] idVal = par.Split("=");
string id = idVal(0);
string val = idVal(1);
rptSrc.Parameters.Add(id, val);
}
rptSrc.ReportDocument = rp;
dynamic rpt = rp as Telerik.Reporting.Report;

ReportProcessor reportProcessor = new ReportProcessor();
RenderingResult result = reportProcessor.RenderReport("PDF", rpt, null);

MemoryStream ms = new MemoryStream(result.DocumentBytes);
ms.Position = 0;

Attachment attachment = new Attachment(ms, rpt.Name + ".pdf");
MailMessage msg = new MailMessage(sender, adresses, subj, body);
msg.ReplyToList.Add(sender);
msg.Attachments.Add(attachment);
System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient();
NetworkCredential netCred = new NetworkCredential();
netCred.UserName = "security@mydomain.com";
netCred.Password = mailPwd;
SmtpServer.Credentials = netCred;
SmtpServer.Port = 587;
//Porta standard SMTP/TSL
SmtpServer.Host = "name.server.com";
SmtpServer.SendMailAsync(msg);
}

Saverio
Top achievements
Rank 1
 answered on 06 Jul 2017
1 answer
68 views

As described in this forum question, I have created a dynamically-sizable page footer by creating an unbound group and enabling PrintAtBottom and PrintOnEveryPage. The problem I am having now, however, is that the resizing isn't playing nicely with the text of the report in the Detail section, and on one page is hiding half a line of text with the whitespace at the top of the footer (defined as padding above the horizontal line, but removing the padding and moving the horizontal line down in the footer section creates the same effect); see attachment.

I have created the footer as belonging to an unbound group instead of creating a PageFooter section in order to enable text in the footer to wrap as necessary without requiring the footer to be enormous all the time.

Stef
Telerik team
 answered on 06 Jul 2017
4 answers
236 views
The angular reporting component does not work with angular universal/SSR due to its jQuery dependency.  Is there any way around this?
Stef
Telerik team
 answered on 06 Jul 2017
2 answers
1.0K+ views
I've been having a ton of trouble hiding a row that is supposed to be empty inside a table, but that still shows up in the table when doing the report; I know this can be done using bindings but I'm not entirely sure if I'm implementing them right, I attached an image showing how I did it and I was hoping if anybody could confirm whether I did it right or not... 
seth
Top achievements
Rank 1
 answered on 05 Jul 2017
1 answer
346 views

I have a printer named XER. How can I print directly to a printer? I'm sharing my code here.

I want to print directly from my printer named XER without previewing..

thank you for your help?

  private void reportViewer1_Load(object sender, EventArgs e)
        {
            try
            {
                var mfrm = (Frm_Giris) Application.OpenForms["Frm_Giris"];
                if (mfrm != null)
                {
                    mfrm.datacenter();
                    var rap = new Prt_AYazdir();
                    rap.a.Value = alma.ToString();
                    rap.b.Value = bal.ToString();
                    rap.c.Value = tarih.ToString();
                    rap.borc.Value = borc.ToString();
                    rap.sqlDataSource1.ConnectionString = mfrm.serveryolu;
                    var ss = "a";

                    ss = "select * from xxxx where    id='" + aid + "' order by id asc; ";
                    rap.sqlDataSource1.SelectCommand = ss;
                    var reportSourcea = new Telerik.Reporting.InstanceReportSource();
                    reportSourcea.ReportDocument = rap;
                    reportViewer1.ReportSource = reportSourcea;
                    reportViewer1.RefreshReport();
                    
                   


                }
            }

Stef
Telerik team
 answered on 05 Jul 2017
3 answers
219 views

I'm using Telerik Reporting for an MVC app and I have a requirement to print payroll checks. I don't need to recreate the entire check, I just need to fill in data in the check for date, amount, etc., in the appropriate areas on the check. 

The payroll checks are on 8.5 x 11 sheets with three checks per sheet, vertically (top to bottom). Therefore, I need to be able to create a report that allows me to basically limit each page to three rows of data, each row representing an individual check. How do I go about doing this? I tried putting a particular field in the detail section three times, but, of course, it just prints the contents of the field three times. It's almost as if I need three detail sections per page (one detail section per check), but I don't see that Telerik Reporting supports that.

Stef
Telerik team
 answered on 04 Jul 2017
37 answers
2.2K+ views
We're using the most recent release of Telerik Reporting.

I have a report that takes a long time to run.  On page load, I default the parameters for the users (most of the time they will use the defaults).

The problem is that, when they load the page (ASP.NET web viewer), and the parameters are filled in, the report runs automatically. 

This is a problem because they do not have the opportunity to change the parameters and have to wait a long time for that intial run. 

So, I do not want the report to run until they hit the Preview button on the web viewer.

Can someone please advise?
Martin
Top achievements
Rank 1
 answered on 04 Jul 2017
1 answer
59 views

Hi,

How can I create a table report with 100 fields across that does not necessary fit into the report?

I do not care to print such a report, except only to save as an excel doc after it renders.

Currently I have memory exception when i run the report.

Can someone help me please?

Thanks,

Ali.

Stef
Telerik team
 answered on 03 Jul 2017
1 answer
141 views

Hi,

I've just create an ASP.NET MVC application with report viewer for ASP.NET MVC.

Everything is working fine but the only issue is currently that if I open the web page from a tablet I can't scroll the report up and down by swiping with the finger.

 

I've seen that within the div where the report is displayed and so where the scrollbars come up there is the style "touch-action: none" hardcoded: by using the debug tools i've changed the value of the property to "auto" and the swipe with the finger then works.

How I can do it with a javascript function? I tried by catching the RenderingEnd event and by "jquery $(".trv-page-wrapper").css("touch-action", "auto");" without success...

Please help me...

 

Thx.

 

 

Luca

 

Stef
Telerik team
 answered on 30 Jun 2017
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?