在ItemDataBinding或ItemDataBound事件telerik报告中获取文本框值

时间:2013-11-06 06:00:20

标签: c# telerik reporting telerik-reporting

我正在处理telerik报告。在我的报告中有三个文本框(textBox14,textBox15,textBox16)。

在textBox14和15中,显示基于总和组标准的数据源的值之和。我想在16中显示textBox14和15值的总和。如何在textBox16的ItemDataBinding或ItemDataBound事件中获取textBox 14和15的值。

private void textBox16_ItemDataBound(object sender, EventArgs e)
    {
        string amt= textBox14.Value;  // It getting only the mapped field name. ie Fields.amt, but I want the display text of the textBox14. There is no .Text property  for textBox14.

        string tax= textBox15.Value; // It getting only the mapped field name. ie Fields.tax, but I want the display text of the textBox14. There is no .Text property  for textBox15.


    }

我想将textBox16值设置为

textBox16.Value = Convert.ToString(ConvetToInt32(amt) + ConvetToInt32(tax)); 

如何获取值?。

2 个答案:

答案 0 :(得分:0)

 private void textBox16_ItemDataBound(object sender, EventArgs e)
        {
            string amt = textBox14.Text;  
            string tax = textBox15.Text; 
        }

然后致电:

 textBox16.Text = Convert.ToString(Convert.ToInt32(amt) + Convert.ToInt32(tax));

答案 1 :(得分:0)

为什么不尝试detail_ItemDataBound事件

private void detail_ItemDataBound(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.DetailSection section = (sender as Telerik.Reporting.Processing.DetailSection);
    Telerik.Reporting.Processing.TextBox = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(section, "textBox14");
    Telerik.Reporting.Processing.TextBox = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(section, "textBox15");
    Telerik.Reporting.Processing.TextBox txtTotal = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(section, "textBox16");
    txtTotal.Value = (Convert.ToInt32(txtAmt.Value) + Convert.ToInt32(txtTax.Value)).ToString();
}