Could you tell me why when I create a new text box in the "detail_ItemDataBinding" method (for each row) ... this new text box is only created in the second row (and in the third row, and in fourth ... but never in the first) ...? I can not create any new text boxes in the first row ... It's the same code for each row
Why it happens?
4 Answers, 1 is accepted
Generally we don't encourage our users to create Telerik Reporting reports programmatically. We do not recommend also the report event handlers (as ItemDataBinding) to be used for modifying report definition.
It is not allowed to add new items in an event because it might cause side effects. Like in this case, the item is added from the second rendering of the Detail section:
Our recommendation is to create a TextBox item design-time and set it's properties on ItemDataBinding event:
For more information, please refer to these help articles:
- Report Events: Using Section Events
- Report Events: Understanding Events
If you need further help, send us the report files, test data and details about the expected behavior in a support ticket.
If a use the "detail_ItemDataBound" event instead of... I can do it... But.. It seems the first row "jumps" to the second one and so... Is there any "bug" in telerik events?
Mistake: "If a use" = "If I use"...Sorry :-)
In general, reports are data-driven which allows you to change an item's settings via conditional formatting, bindings and expression used as Value property, all based on the data fields.
So, my recommendation is to create TextBox items design-time, then modify their properties on ItemDataBinding event and use conditional formatting or binding rule to conditionally hide them. In case you have a complex requirement to show/hide data, you could create an user function that allow you to extend the default behavior of the Telerik Reporting engine.
As a side note, more considerations on this topic are provided in Modifying or Creating a report at Run-Time KB article.
Back to your question regarding the incorrect behavior of events, we would need to check the code of event handlers in order to provide you further suggestion. You can share it here or in a new support ticket.