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

Changing TextBox value on runtime

2 Answers 532 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Patrick Maurer
Top achievements
Rank 1
Patrick Maurer asked on 26 May 2008, 11:20 AM
Hi,

the samples and posts in the forum are not very clear about that:

Say I have a List<MyDataObject> as Datasource, and MyDataObject has three Properties: double Value1, double Value2 and bool NeedsReformatting. On the Report I have in the detail area two textboxes, one for Value1 and one for Value2.

If NeedsReformatting is false, the Textboxes should display the values, if it is true they should display a dash "-".

I tried this with the Item DataBound event, but using the Processing classes the value is not changed and using the Reporting classes I cannot access the original value of the Data object bound to the current row.

Can you post a simple sample showing how to change the senders (Textbox) text regarding to a certain value of the databound object?

Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Patrick Maurer
Top achievements
Rank 1
answered on 27 May 2008, 02:21 PM
*Push*

Sorry, but this is still a major problem.
0
Steve
Telerik team
answered on 28 May 2008, 02:14 PM
Hello Patrick,

Looking at your code, most likely the problem you experience is caused by the fact that you are working with the Report definition items and not with the Processing items as you should be.  Please review the help article Understanding Events for more detailed explanation on why you should use the processing items. We also highly recommend to review the Report Life Cycle article to understand why this is needed.
I've just tested this locally and it works properly for me:

 private void productNameDataTextBox_ItemDataBound(object sender, System.EventArgs e)
        {
          productNameDataTextBox.Value = "=IIf(Fields.Discontinued, \'-\', Fields.ProductName)";
        }


You can also easily set that through the expression builder (see attached screenshot), which we have designed especially to ease you in such cases.

Let us know if further help is needed.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Patrick Maurer
Top achievements
Rank 1
Answers by
Patrick Maurer
Top achievements
Rank 1
Steve
Telerik team
Share this question
or