Hello -
I have a report in which has two textbox controls that are placed on the same spot on the report layout. Only one can have a value at a time (rules handled by the app user interface and database).
What I want to do is place them on top of each other in the desinger, but then only have one's Visible property set to True if it has data.
How can I do this with the Telerik reporting? Unlike SSRS, there doesn't appear to be any expression builders.
Thanks,
- will
I have a report in which has two textbox controls that are placed on the same spot on the report layout. Only one can have a value at a time (rules handled by the app user interface and database).
What I want to do is place them on top of each other in the desinger, but then only have one's Visible property set to True if it has data.
How can I do this with the Telerik reporting? Unlike SSRS, there doesn't appear to be any expression builders.
Thanks,
- will
5 Answers, 1 is accepted
0
Hi Will,
To accomplish this task you should implement an event handler for the ItemDataBound event of the TextBoxes. It should look like the following:
using Processing = Telerik.Reporting.Processing;
...
private void textBox1_ItemDataBound(object sender, System.EventArgs e)
{
Processing.TextBox textBox = (Processing.TextBox)sender;
textBox.Visible = !string.IsNullOrEmpty(textBox.Text);
}
If needed, you can change the expression which determines the value of the Visible property of the TextBox.
Hope this helps. Let me know if you have any other questions regarding this issue.
Kind regards,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
To accomplish this task you should implement an event handler for the ItemDataBound event of the TextBoxes. It should look like the following:
using Processing = Telerik.Reporting.Processing;
...
private void textBox1_ItemDataBound(object sender, System.EventArgs e)
{
Processing.TextBox textBox = (Processing.TextBox)sender;
textBox.Visible = !string.IsNullOrEmpty(textBox.Text);
}
If needed, you can change the expression which determines the value of the Visible property of the TextBox.
Hope this helps. Let me know if you have any other questions regarding this issue.
Kind regards,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Will
Top achievements
Rank 1
answered on 21 Aug 2007, 03:13 PM
Hello again Chavdar -
Thanks for the information. This helps a great deal.
Regards -
Will
Thanks for the information. This helps a great deal.
Regards -
Will
0

Will
Top achievements
Rank 1
answered on 22 Aug 2007, 06:48 AM
Hi,
I tried what you suggested, but I can't get it to work. I added the ItemDataBound event for my two text controls and they are always visible.
Also, can you include an example in VB.Net?
Thanks
- will
I tried what you suggested, but I can't get it to work. I added the ItemDataBound event for my two text controls and they are always visible.
Also, can you include an example in VB.Net?
Thanks
- will
0
Hi Will,
Here is the method body in VB.NET:
Dim textBox As Processing.TextBox = DirectCast(sender, Processing.TextBox)
textBox.Visible = Not String.IsNullOrEmpty(textBox.Text)
Make sure that the event handler is executed correctly by setting a break point in it and running the application in debug mode. If the break point is not hit then it is possible that the event handler is not attached properly to the event. If the break point is hit then check what value is returned by the expression for the Visible property of the TextBox. It might happen that the value is true for both Textboxes.
If it is still not working, please, open a support ticket and send us the report definition so that we can look at it locally.
Sincerely yours,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Here is the method body in VB.NET:
Dim textBox As Processing.TextBox = DirectCast(sender, Processing.TextBox)
textBox.Visible = Not String.IsNullOrEmpty(textBox.Text)
Make sure that the event handler is executed correctly by setting a break point in it and running the application in debug mode. If the break point is not hit then it is possible that the event handler is not attached properly to the event. If the break point is hit then check what value is returned by the expression for the Visible property of the TextBox. It might happen that the value is true for both Textboxes.
If it is still not working, please, open a support ticket and send us the report definition so that we can look at it locally.
Sincerely yours,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Will
Top achievements
Rank 1
answered on 22 Aug 2007, 09:56 PM
Hey again,
Thanks for the code sample and help. This works great now.
- will
Thanks for the code sample and help. This works great now.
- will