combit List & Label 25 - .NET Online Web Help
OnListLabelRequest Event (Html5ViewerConfig)
Example 


combit.ListLabel25.Web Namespace > Html5ViewerConfig Class : OnListLabelRequest Event
Event that is called when the Html5Viewer exports a report and no OnListLabelRequest handler was set for the Html5ViewerOptions object of the Html5Viewer instance. This event must create a fully initialized List & Label instance.
Syntax
'Declaration
 
Public Event OnListLabelRequest As EventHandler(Of ListLabelRequestEventArgs)
public event EventHandler<ListLabelRequestEventArgs> OnListLabelRequest
public:
event EventHandler<ListLabelRequestEventArgs^>^ OnListLabelRequest
Event Data

The event handler receives an argument of type ListLabelRequestEventArgs containing data related to this event. The following ListLabelRequestEventArgs properties provide information specific to this event.

PropertyDescription
A custom object that was passed by the user when creating the viewer control.  
Sets the directory for temporary files that are generated while the report is created.  
If true, the Html5Preview will use the LL instance created in this callback for its own settings (language etc.).  
Returns the logger of the Html5Viewer instance as defined in Html5ViewerOptions.SetLogger. It is recommended to pass this logger to the ListLabel constructor in your event handler.  
This property must be assigned to the created List & Label instance.  
Contains the report name that was specified in the ReportName property (Html5ViewerControl) or the report name argument of @Html.Html5Viewer().  
Example
string _reportsPath;

protected void Application_Start(Object sender, EventArgs e)
{
   Html5ViewerConfig.RegisterRoutes(RouteTable.Routes);
   Html5ViewerConfig.OnListLabelRequest += Services_OnListLabelRequest;
   _reportsPath = Server.MapPath("~/reports/");
}

void Services_OnListLabelRequest(object sender, ListLabelRequestEventArgs e)
{
   ListLabel ll = new ListLabel();
   //Set datasource
   ll.DataSource = DataAccess.CreateProviderCollection();
   ll.AutoProjectFile = _reportsPath + e.ReportName;
   //Set temp directory
   e.ExportPath = Path.GetTempPath();  
   e.NewInstance = ll;
}
Requirements

Platforms: Windows 7 SP1 - Windows 10 Version 1909, Windows Server 2008 R2 - 2019

See Also