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

Access different textbox from itemdatabound event

2 Answers 351 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bruce Hochstetler
Top achievements
Rank 2
Bruce Hochstetler asked on 18 Dec 2007, 12:52 AM
Hi,

I have a itemdatabound event handler on a particular textbox, based on the value in it I need to set a different textbox. Haven't been able to figure out how to access other textboxes from the event handler.

Thanks,
Bruce

2 Answers, 1 is accepted

Sort by
0
Accepted
Milen | Product Manager @DX
Telerik team
answered on 18 Dec 2007, 02:04 PM
Hello Bruce Hochstetler,

Thank you for your question.

In order to achieve this, you have to make sure that both items are databound at the time you read or overwrite their text. This means that you have to choose really carefully which event to use. For example, if the two items are in the Detail section, it is reasonable to use the ItemDataBound event of that section, because that event is raised when all the items in the section are databound.

        private void detail_ItemDataBound(object sender, System.EventArgs e)
{
Telerik.Reporting.Processing.DetailSection detail = (Telerik.Reporting.Processing.DetailSection)sender;
Telerik.Reporting.Processing.TextBox text1 = (Telerik.Reporting.Processing.TextBox)detail.Items["textBox1"];
Telerik.Reporting.Processing.TextBox text2 = (Telerik.Reporting.Processing.TextBox)detail.Items["textBox2"];
text2.Text = text1.Text;
}

I hope this information helps.

Best wishes,
Milen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Bruce Hochstetler
Top achievements
Rank 2
answered on 18 Dec 2007, 06:08 PM
Hi Milen,

That work great. What I did was create field that was databound, but hidden. Then based on the contents of the first field, I would either use the visible field's data, or the hidden field's data. The detail itemdatabound event did the trick.

Thanks,
Bruce
Tags
General Discussions
Asked by
Bruce Hochstetler
Top achievements
Rank 2
Answers by
Milen | Product Manager @DX
Telerik team
Bruce Hochstetler
Top achievements
Rank 2
Share this question
or