Set Panel.Enabled via DataBand.BeforePrintEvent.Script
Set Panel.Enabled via DataBand.BeforePrintEvent.Script
Hi, I am creating a label report via code and want to hide the label container panel based on the value of a variable. But it does not work and the panel always shows when the report is displayed in either the Silverlight viewer or designer/preview. If I save the report and then load in the stand-alone designer it works and the first 4 labels are hidden. Below is part of the code I am using, and I have attached the saved report:
StiDataBand objDataBand = new StiDataBand();
objDataBand.Height = LabelDefinition.Style.LabelStyle_LabelPitchVertical;
objDataBand.Name = "DataBand";
objDataBand.BusinessObjectGuid = ReportDefinition.Dictionary.BusinessObjects[0].Guid;
objDataBand.Columns = intCols;
objDataBand.ColumnWidth = LabelDefinition.Style.LabelStyle_LabelWidth;
objDataBand.ColumnDirection = StiColumnDirection.AcrossThenDown;
objDataBand.ColumnGaps = LabelDefinition.Style.LabelStyle_LabelPitchHorizonal - LabelDefinition.Style.LabelStyle_LabelWidth;
objReportPage.Components.Add(objDataBand);
StiPanel objLabelArea = new StiPanel(new RectangleD(0,0,LabelDefinition.Style.LabelStyle_LabelWidth,LabelDefinition.Style.LabelStyle_LabelHeight));
objLabelArea.Name = "LabelArea";
objDataBand.Components.Add(objLabelArea);
objDataBand.BeforePrintEvent.Script = "LabelArea.Enabled = (StartLabel <= 0)";
objDataBand.AfterPrintEvent.Script = "StartLabel--";
I have also tried enclosing StartLabel in {} but that did not work either.
I would be grateful for you could tell me what I am doing wrong?
StiDataBand objDataBand = new StiDataBand();
objDataBand.Height = LabelDefinition.Style.LabelStyle_LabelPitchVertical;
objDataBand.Name = "DataBand";
objDataBand.BusinessObjectGuid = ReportDefinition.Dictionary.BusinessObjects[0].Guid;
objDataBand.Columns = intCols;
objDataBand.ColumnWidth = LabelDefinition.Style.LabelStyle_LabelWidth;
objDataBand.ColumnDirection = StiColumnDirection.AcrossThenDown;
objDataBand.ColumnGaps = LabelDefinition.Style.LabelStyle_LabelPitchHorizonal - LabelDefinition.Style.LabelStyle_LabelWidth;
objReportPage.Components.Add(objDataBand);
StiPanel objLabelArea = new StiPanel(new RectangleD(0,0,LabelDefinition.Style.LabelStyle_LabelWidth,LabelDefinition.Style.LabelStyle_LabelHeight));
objLabelArea.Name = "LabelArea";
objDataBand.Components.Add(objLabelArea);
objDataBand.BeforePrintEvent.Script = "LabelArea.Enabled = (StartLabel <= 0)";
objDataBand.AfterPrintEvent.Script = "StartLabel--";
I have also tried enclosing StartLabel in {} but that did not work either.
I would be grateful for you could tell me what I am doing wrong?
- Attachments
-
- 1892.Report.mrt
- (8.76 KiB) Downloaded 586 times
Set Panel.Enabled via DataBand.BeforePrintEvent.Script
Hello,
Please try to disable labels in conditions instead a code.
Also can you please send us a sample project with test data for analysis.
Thank you.
Please try to disable labels in conditions instead a code.
Also can you please send us a sample project with test data for analysis.
Thank you.
Set Panel.Enabled via DataBand.BeforePrintEvent.Script
Hi,
Pleae find attached a sample project which demonstrates the problem.
The label report is generated entily in code. I want to start printing labels at a set row and column, a variable (StartLabel) is added which in my live application is calculated as ((Start label row - 1) * No of labels across) + (Start label column - 1)
e.g. No of labels across: 3, Start row: 2, Start column: 2 = Skip the first 4 labels (StartLabel = 4)
In the DataBand before print event I want to set the LabelArea.Enabled = false when StartLabel is greater than 0
objDataBand.BeforePrintEvent = new Stimulsoft.Report.Events.StiBeforePrintEvent("LabelArea.Enabled = ({StartLabel} <= 0)");
In the DataBand after print event I want to decrement StartLabel
objDataBand.AfterPrintEvent = new Stimulsoft.Report.Events.StiAfterPrintEvent("{StartLabel}--");
As you will see in the attached project, neither the BeforePrintEvent or AfterPrintEvent seem to execute.
Pleae find attached a sample project which demonstrates the problem.
The label report is generated entily in code. I want to start printing labels at a set row and column, a variable (StartLabel) is added which in my live application is calculated as ((Start label row - 1) * No of labels across) + (Start label column - 1)
e.g. No of labels across: 3, Start row: 2, Start column: 2 = Skip the first 4 labels (StartLabel = 4)
In the DataBand before print event I want to set the LabelArea.Enabled = false when StartLabel is greater than 0
objDataBand.BeforePrintEvent = new Stimulsoft.Report.Events.StiBeforePrintEvent("LabelArea.Enabled = ({StartLabel} <= 0)");
In the DataBand after print event I want to decrement StartLabel
objDataBand.AfterPrintEvent = new Stimulsoft.Report.Events.StiAfterPrintEvent("{StartLabel}--");
As you will see in the attached project, neither the BeforePrintEvent or AfterPrintEvent seem to execute.
- Attachments
-
- 1985.ReportTest.zip
- (91.76 KiB) Downloaded 376 times
Re: Set Panel.Enabled via DataBand.BeforePrintEvent.Script
Can anyone please help with this?
Re: Set Panel.Enabled via DataBand.BeforePrintEvent.Script
Hello,
Your solution working for client-server version. But native silverlight version has not compilation and events does not working.
In this case, you need to use conditions.
Thank you.
Your solution working for client-server version. But native silverlight version has not compilation and events does not working.
In this case, you need to use conditions.
Thank you.
Re: Set Panel.Enabled via DataBand.BeforePrintEvent.Script
Thanks Aleksey.
This worked:
objLabelArea.Conditions.Add(new StiCondition() { Column = "Students.BarcodeNumber", Condition = StiFilterCondition.LessThanOrEqualTo, DataType = StiFilterDataType.Numeric, Value1 = "0", Enabled = false });
This worked:
objLabelArea.Conditions.Add(new StiCondition() { Column = "Students.BarcodeNumber", Condition = StiFilterCondition.LessThanOrEqualTo, DataType = StiFilterDataType.Numeric, Value1 = "0", Enabled = false });
Re: Set Panel.Enabled via DataBand.BeforePrintEvent.Script
Hello,
Let us know if you need any additional help.
Thank you.
Let us know if you need any additional help.
Thank you.