Any help is appreciated.
Thx
7 Answers, 1 is accepted
using System.Data; |
using Processing = Telerik.Reporting.Processing; |
//... |
private void detail_ItemDataBound(object sender, System.EventArgs e) |
{ |
// Get the detail section object from sender |
Processing.DetailSection section = (Processing.DetailSection)sender; |
// From the section object get the DataRowView |
DataRowView dataRowView = (DataRowView)section.DataItem; |
// Also from the section object get the items in the report |
Processing.ReportItemBase[] items = |
(Processing.ReportItemBase[])section.Items.Find("tbCombined", false); |
/// Get the specific report item you want to change, |
/// use the dataRowView to get the underlying data, |
/// then change the report item properties based on the data. |
if (items.Length > 0) |
{ |
Processing.TextBox item = items[0] as Processing.TextBox; |
item.Value = |
dataRowView["FirstName"].ToString() |
+ " " + |
dataRowView["LastName"].ToString(); |
} |
} |
that was what I was looking for. At first I thought is was possible on the page where the report is shown (rendered), but I see I have to do it in the report itselft.
Thanks for the help.
This is possible through the calling application as well. Here is a sample:
protected void Button1_Click(object sender, EventArgs e) |
{ |
Telerik.Reporting.TextBox txt = this.ReportViewer1.Report.Items.Find("textBox1", true)[0] as Telerik.Reporting.TextBox; |
txt.Value = "set through app"; |
} |
Hope this helps.
Sincerely yours,
Steve
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
great, that is even better in our situation.
thx
Hello
it looks like the last proposed solution
Dim txt As Telerik.Reporting.TextBox = TryCast(Me.ReportViewer1.Report.Items.Find("textBox1", True)(0), Telerik.Reporting.TextBox)
txt.Value = "set through app"
is now obsolete and I could not find the replacement syntax ...
Thanks for providing the new syntax
Regards
Pierre-Jean
Hello Pierre-Jean,
You can take a look at Access Report Items Programmatically which provides different approaches in C#/VB for accessing a report item from within the report and from the invoking application.
Let us know if you need further help.
Regards,
Neli
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Thanks a lot
I'll give it a try and Keep you posted
Best regards
Pierre-Jean