This is a migrated thread and some comments may be shown as answers.

ItemDefinition Action doesn't work after upgrade Reporting from (version 10.0.16.204) to (version 11.0.17.222)

1 Answer 16 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hao
Top achievements
Rank 1
Hao asked on 04 Mar 2017, 05:29 AM

Hi Telerik admin,

I assume I have a textbox in Reporting, and I customize in Databinding events, like below:

private void textBox9_ItemDataBinding(object sender, EventArgs e)
        {
            var textBox = sender as Telerik.Reporting.Processing.TextBox;
            if (textBox != null)
            {
                var myLink = new NavigateToUrlAction
                {
                    Target = UrlTarget.NewWindow,
                    Url = "https://www.google.com"
                };
                textBox.ItemDefinition.Action = myLink;
            }
        }

In old version, after binding, this work. I can click in my textbox. But, after upgrade to laster version. It doesn't work. I've debug in new version, everything seem ok, but after that, I can't click my textbox. Can u help me ?

Thanks

1 Answer, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 07 Mar 2017, 12:19 PM
Hi Hao,

You can check an update in the support ticket #1095961 that you opened on the same issue.

For other community members interested in this topic, below is the reply from the support ticket:

"When subscribing to ItemDataBound event, you are working with the Processing.TextBox, which is an instance that is created from the TextBox definition and is currently being processed and rendered. As a rule of thumb we recommend to avoid using the ItemDataBinding and ItemDataBound events if the problem can be solved using BindingsConditional formatting or modifying the definition. The reason is that the processing of the current item has already started (based on its definition) and your changes may not be applied correctly, as in this case.

You can solve your problem in two ways:

  1. Change the textbox definition right after InitializeComponent() line in your report. This will ensure that when the processing of the textbox item starts, its definition will contain the needed action.

  2. Use Bindings - create a UserFunction that returns a NavigateToUrlAction instance as shown below:
public static IAction CreateAction()
{
   return new NavigateToUrlAction() { Url = "https://www.google.com", Target = UrlTarget.NewWindow };
}
Create a new Binding, setting Action as PropertyPath and your user function as Expression."


Regards,
Katia
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Hao
Top achievements
Rank 1
Answers by
Katia
Telerik team
Share this question
or