I am using ReportWriter 1.6.0 from an ASP.Net application. The ASPX samples that came with 1.6.0 do not show a sample of event handling. Is there a sample of event handling available for reference.
Thanks, David.
Event Handler
Re: Event Handler
Support · Aug 27, 2007Hello David,
We do not have any sample example that shows handling events using the ASPX examples. We do have ASP example that shows how to do event handling.
Thanks,
ceTe Software Support Team
Re: Event Handler
Forum member · Aug 27, 2007Could you show in a reply post how you would code an OnDraw event handler?
Thanks.
Re: Event Handler
Support · Aug 27, 2007Hello,
Following is the sample code taken from the Invoce_Events ASP example.
Function LineTotal_OnDraw( TextArea )
Dim intLineTotal
intLineTotal = m_objReport.Recordset("UnitPrice") * m_objReport.Recordset("Quantity")
m_intSubTotal = m_intSubTotal + intLineTotal
TextArea.Text = FormatNumber(intLineTotal)
End Function
Thanks,
ceTe Software Support Team
Re: Event Handler
Forum member · Aug 28, 2007Got that part. What would the OnDraw call look like since ASP.NET does not support "Set" or "GetRef"? Could you show me what that would look like within the SetBodyObj Sub?
Thanks for all of your help.
Re: Event Handler
Support · Aug 28, 2007Hello,
In ASP.NET the way to call events is using the sample lines below:
body.OnDraw += new OnDrawEventHandler( On_Draw );
private void On_Draw( object sender, OpeningRecordSetEventArgs e )
{
// Add event handling code
}
Thanks,
ceTe Software Support Team
Re: Event Handler
Forum member · Aug 28, 2007I think I was going down the wrong path and trying to make this harder than it is. At the end of my report in SectionFooter sub I am wanting to show a total number of records process. (Possibly number of records in recordset would even work) Is there a way to count the number of records or show the total records at the end of my report in the SectionFooter. I am using ASP.Net with Visual Basic as code behind language.
Thanks again for any help.
Re: Event Handler
Support · Aug 28, 2007Hello,
You can modify the query to use the Count(*) and store that value in a variable and then display it in the SectionFooter using the AddLabel method.
You can also get the count using the RecordSet object using sample code below:
Dim objRS As ADODB.Recordset
'Store the result in a recordset
Set objRS = objCom.Execute
'Open the recordset
Do While Not objRS.EOF
'Increment a counter
Loop
Thanks,
ceTe Software Support Team
Re: Event Handler
Forum member · Aug 28, 2007You may have just put me on the right track. I already had a Count(*) variable in by recordset. I was using an AddRecordBox, referencing the variable, in the SectionFooter and it worked perfect as long as I had records. When my query did not select any records I received an EOF exception. I was not for sure how to reference the variable from an AddLabel.
Re: Event Handler
Support · Aug 29, 2007Hello,
The Count(*) will return "0" if there are no records present. You will have to store the value returned by the Count(*) into a variable and cast it into a string. You can use this string in the AddLabel method without any problem.
Thanks,
ceTe Software Support Team.