Handling Events in Web Form
Handling events for any elements defined within a particular DPLX file is very straight forward. One must simply define a method named after the following model:
ElementName_EventName
See Using a DPLX file from a Web Form for more on associating a DPLX file with a Web Form. For handling events from within a non Web Form example see, Using a DPLX File.
The following code example demonstrates how to specify and code an event handler for the LaidOut event of the PlaceHolder report element in order to dynamically place a Barcode in the PlaceHolder:
public class DplxWebExample : ceTe.DynamicPDF.ReportWriter.DplxWebForm
{
private void page_Load(object sender, System.EventArgs e)
{
DrawPdfToWeb("Invoice.pdf");
}
private void BarcodePlaceHolder_LaidOut( object sender, PlaceHolderLaidOutEventArgs e )
{
Code128 barcode = new Code128( e.LayoutWriter.RecordSets.Current["OrderID"].ToString(), 0, 0, e.ContentArea.Height );
barcode.X += ( e.ContentArea.Width - barcode.GetSymbolWidth() ) / 2;
barcode.ShowText = false;
e.ContentArea.Add( barcode );
}
}
Public Class DplxWebExample
Inherits ceTe.DynamicPDF.ReportWriter.DplxWebForm
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DrawPdfToWeb("Invoice.pdf")
End Sub
Private Sub BarcodePlaceholder_LaidOut(ByVal sender As Object, ByVal e As PlaceHolderLaidOutEventArgs)
Dim MyBarcode As Code128 = New Code128(e.LayoutWriter.RecordSets.Current("OrderID").ToString(), 0, 0, e.ContentArea.Height)
MyBarcode.X += (e.ContentArea.Width - MyBarcode.GetSymbolWidth()) / 2
MyBarcode.ShowText = False
e.ContentArea.Add(MyBarcode)
End Sub