I group records in my report. In group's footer section, i display a single value(which is actually same for the same group) onto my textbox from each and every single group in group footer section of the group. Then i need to get all values of the textboxes in the groups footer section . How can i get them programmatically? I know how to get an item however, when an item(here textbox) being diplayed accoring to the number of the groups resides in final report, i don't know how i can get all the values?
Such as:
Could someone pls help me?
Thanks in advance...
Such as:
Telerik.Reporting.
TextBox txt = (ReportViewer.Report as MyRaport).Items.Find("textBox13", true)[0] as Telerik.Reporting.TextBox;
txt.Visible = false;
Could someone pls help me?
Thanks in advance...
6 Answers, 1 is accepted
0
Hi Kem Arda,
It will be helpful for us if you provide some simple example of what are you trying to achieve, so that we can assist you more accurately.
However if you need to access some already evaluated item and read its value you can use the ItemEvents, which are fired before and after the item is fed with data and evaluated (like the TextBox.Value).
If you need general understanding on how to use these events, please refer to the help article Understanding Events. The main idea is to access the processing instance of the item through the sender parameter of the event handler.
Hope this information helps.
Sincerely yours,
Milen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
It will be helpful for us if you provide some simple example of what are you trying to achieve, so that we can assist you more accurately.
However if you need to access some already evaluated item and read its value you can use the ItemEvents, which are fired before and after the item is fed with data and evaluated (like the TextBox.Value).
If you need general understanding on how to use these events, please refer to the help article Understanding Events. The main idea is to access the processing instance of the item through the sender parameter of the event handler.
Hope this information helps.
Sincerely yours,
Milen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kem Arda
Top achievements
Rank 1
answered on 28 Aug 2009, 01:17 PM
I used those event. Let me explain. In MyTextBoxOnGroup_ItemDataBound, i read the evaluated item (here textbox resides in group on my report) and i add the integer values. And then i want to assign that total value to another textbox outsidethe ragarding group(in whih residex my textbox MyTextBoxOnGrou as i mentioned above) in my report's footer.
private void MyTextBoxOnGroup_ItemDataBound(object sender, EventArgs e)
{
Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)sender;
if (txt.Text != "")
{
toplam = toplam + Convert.ToDouble(txt.Text.Trim()); // toplam is a private global variable in that class.
this.textBoxTarget.Value = toplam.ToString();
}
}
Thanks...
private void MyTextBoxOnGroup_ItemDataBound(object sender, EventArgs e)
{
Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)sender;
if (txt.Text != "")
{
toplam = toplam + Convert.ToDouble(txt.Text.Trim()); // toplam is a private global variable in that class.
this.textBoxTarget.Value = toplam.ToString();
}
}
Thanks...
0
Accepted
Hello Kem Arda,
As far as I understand, you are trying to render a grand total (total of all the groups) in the report footer. You can easily achieve this by using appropriate expression as a Value of the TextBox item inside the report footer. Something like:
=Sum(...)
You may review this help article for additional information on using expression.
Still, if you have some complicated logic, and you need to manually traverse all group footer items, you can access (and aggregate) them in the ItemDataBound event (as you did).
private double toplam;
...
private void MyTextBoxOnGroup_ItemDataBound(object sender, EventArgs e)
{
Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)sender;
if (txt.Text != "")
{
toplam = toplam + Convert.ToDouble(txt.Text.Trim());
}
}
But then use the aggregated value in ItemDataBound of an item that contains both the items you read and you will write in, so that you are sure their ItemDtaBound events are already past, for example on the report itself. Also, you need to set the value again on the processing instance of the wanted item:
private void Report1_ItemDataBound(object sender, EventArgs e)
{
Telerik.Reporting.Processing.Report rpt = (Telerik.Reporting.Processing.Report)sender;
Telerik.Reporting.Processing.TextBox target = (Processing.TextBox)rpt.ChildElements.Find("textBoxTarget", true)[0];
target.Value = toplam.ToString();
}
}
Write us if you need further assistance.
Best wishes,
Milen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
As far as I understand, you are trying to render a grand total (total of all the groups) in the report footer. You can easily achieve this by using appropriate expression as a Value of the TextBox item inside the report footer. Something like:
=Sum(...)
You may review this help article for additional information on using expression.
Still, if you have some complicated logic, and you need to manually traverse all group footer items, you can access (and aggregate) them in the ItemDataBound event (as you did).
private double toplam;
...
private void MyTextBoxOnGroup_ItemDataBound(object sender, EventArgs e)
{
Telerik.Reporting.Processing.TextBox txt = (Telerik.Reporting.Processing.TextBox)sender;
if (txt.Text != "")
{
toplam = toplam + Convert.ToDouble(txt.Text.Trim());
}
}
But then use the aggregated value in ItemDataBound of an item that contains both the items you read and you will write in, so that you are sure their ItemDtaBound events are already past, for example on the report itself. Also, you need to set the value again on the processing instance of the wanted item:
private void Report1_ItemDataBound(object sender, EventArgs e)
{
Telerik.Reporting.Processing.Report rpt = (Telerik.Reporting.Processing.Report)sender;
Telerik.Reporting.Processing.TextBox target = (Processing.TextBox)rpt.ChildElements.Find("textBoxTarget", true)[0];
target.Value = toplam.ToString();
}
}
Write us if you need further assistance.
Best wishes,
Milen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kem Arda
Top achievements
Rank 1
answered on 04 Sep 2009, 07:17 AM
It' been resolved in the way you posted here. Thanks...
0
Napa
Top achievements
Rank 1
answered on 04 Jun 2013, 02:48 PM
i have one problem in telerik report.I am trying to hiding text boxes based on condition.below is the my code.Please help me.
private void textBox35_ItemDataBound(object sender, EventArgs e)
{
Telerik.Reporting.Processing.
TextBox txt1 = (Telerik.Reporting.Processing.TextBox)sender;
if (txt1.Text == "0")
{
pROJECT_NODataTextBox.Visible =
false;
textBox35.Visible =
false;
textBox50.Visible =
false;
textBox55.Visible =
false;
textBox66.Visible =
false;
textBox80.Visible =
false;
textBox94.Visible =
false;
}
else
{
pROJECT_NODataTextBox.Visible =
true;
textBox35.Visible =
true;
textBox50.Visible =
true;
textBox55.Visible =
true;
textBox66.Visible =
true;
textBox80.Visible =
true;
textBox94.Visible =
true;
}
}
0
Hi Napa,
Modifying the report definition in the specified way is not recommended. Please use binding or conditional formatting based on the expression used for the value of the TextBox item(textBox35) to show/hide items.
I hope this helps.
Regards,
Stef
Telerik
Modifying the report definition in the specified way is not recommended. Please use binding or conditional formatting based on the expression used for the value of the TextBox item(textBox35) to show/hide items.
I hope this helps.
Regards,
Stef
Telerik
Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.