Find sibling components in a rendered DataBand-Row
Find sibling components in a rendered DataBand-Row
Hello,
how can i get access to all sibling components in a rendered StiDataBand?
After the Databand is rendered (EndRender-Event) i attached a ClickEvent-Handler to all Components. When clicking on a rendered component i like to get access to all sibling components in the same rendered row.
All i get is access to the Parent component which here is the current page. From that page component i can find ALL components of the page which is way too much. I need only to find the related components of the same row.
Any suggestions or solutions?
Kind regards
Thorsten Pontow
how can i get access to all sibling components in a rendered StiDataBand?
After the Databand is rendered (EndRender-Event) i attached a ClickEvent-Handler to all Components. When clicking on a rendered component i like to get access to all sibling components in the same rendered row.
All i get is access to the Parent component which here is the current page. From that page component i can find ALL components of the page which is way too much. I need only to find the related components of the same row.
Any suggestions or solutions?
Kind regards
Thorsten Pontow
Thorsten Pontow
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Re: Find sibling components in a rendered DataBand-Row
Hello.
If we understand you correctly, you should use drill-down reports.
Please, try to watch our videos where you could learn how to build Drill-down reports. You could find them on our site http://www.stimulsoft.com/en/videos
Also look at the Interactive Reports section of our Demo.
Thank you.
If we understand you correctly, you should use drill-down reports.
Please, try to watch our videos where you could learn how to build Drill-down reports. You could find them on our site http://www.stimulsoft.com/en/videos
Also look at the Interactive Reports section of our Demo.
Thank you.
Re: Find sibling components in a rendered DataBand-Row
Hi,
the Drill-Down report is unfortunately not what i need here. My final goal in the end is to find the business object used for rendering the data row where the component i've clicked on is embedded.
I know i can go through the rows with DataBand.First() / DataBand.Next() and then check the DataBand.BusinessObject.Current property. But maybe there is better way?
Thanks...
the Drill-Down report is unfortunately not what i need here. My final goal in the end is to find the business object used for rendering the data row where the component i've clicked on is embedded.
I know i can go through the rows with DataBand.First() / DataBand.Next() and then check the DataBand.BusinessObject.Current property. But maybe there is better way?
Thanks...
Thorsten Pontow
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Re: Find sibling components in a rendered DataBand-Row
Hello.
We don't enough understand your problem.
Could you explain your situation more detailed if it's possible with examples.
Thank you.
We don't enough understand your problem.
Could you explain your situation more detailed if it's possible with examples.
Thank you.
Re: Find sibling components in a rendered DataBand-Row
Hello,
DataBand.BusinessObject.Current
and then you can use the TagValue property.
Thank you.
As a way, you can use in the Tag property (Interaction - Tag):tpontow wrote:I know i can go through the rows with DataBand.First() / DataBand.Next() and then check the DataBand.BusinessObject.Current property. But maybe there is better way?
DataBand.BusinessObject.Current
and then you can use the TagValue property.
Thank you.
Re: Find sibling components in a rendered DataBand-Row
Hallo Aleksey,
I cannot find any data in the Interaction property. For every component i am clicking on the Interaction property is null. Do you have any samples for the use of Interaction in context with BusinessObjects?
All i need is the information which business data is used for rendering a certain report row when clicking on a report component in this row in preview.
Thanks
Thorsten
I cannot find any data in the Interaction property. For every component i am clicking on the Interaction property is null. Do you have any samples for the use of Interaction in context with BusinessObjects?
All i need is the information which business data is used for rendering a certain report row when clicking on a report component in this row in preview.
Thanks
Thorsten
Thorsten Pontow
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Re: Find sibling components in a rendered DataBand-Row
Hello,
Sorry for mistake. In this case, you can use the following expression in the GetTag event instead the property Tag(Interaction):
and then you can use the following code in Click events (as example):
Please see the sample report in attachment.
Let us know if you need any additional help.
Thank you.
Sorry for mistake. In this case, you can use the following expression in the GetTag event instead the property Tag(Interaction):
Code: Select all
e.Value = DataBand2.BusinessObject.Current;
Code: Select all
string s = ((DataRow)((StiText)sender).TagValue)["ProductID"].ToString() + " \n" +
((DataRow)((StiText)sender).TagValue)["ProductName"].ToString() + " \n" +
((DataRow)((StiText)sender).TagValue)["UnitPrice"].ToString();
MessageBox.Show(s);
Let us know if you need any additional help.
Thank you.
- Attachments
-
- SampleDetailBusinessObjects.mrt
- (24.3 KiB) Downloaded 361 times
Re: Find sibling components in a rendered DataBand-Row
Hallo Aleksey,
thanks for your quick response. Your last post provided me with the missing information. So it solved my problem and everything works fine now.
With that i understand now better how everything works together.
Thanks again
Thorsten Pontow
thanks for your quick response. Your last post provided me with the missing information. So it solved my problem and everything works fine now.
With that i understand now better how everything works together.
Thanks again
Thorsten Pontow
Thorsten Pontow
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
Re: Find sibling components in a rendered DataBand-Row
Hello,
We are always glad to help you!
Let us know if you need any additional help.
Thank you.
We are always glad to help you!
Let us know if you need any additional help.
Thank you.
Re: Find sibling components in a rendered DataBand-Row
Code for my solution now is as follows:
- Register Click- and GetTag-Events for all StiText instances in the DataBand after report is loaded and compiled.
Code: Select all
StiReport report = new StiReport(); report.RegBusinessObject("test","test", dataSource); report.Load(@"..."); report.Compile(); //m_dataBand is local class variable. m_dataBand = report.CompiledReport.GetComponents()["DataBand1"] as StiDataBand; if (!ReferenceEquals(m_dataBand, null)) { foreach (var component in m_dataBand.GetComponents()) { StiText text = component as StiText; if (!ReferenceEquals(text, null)) { text.GetTag += ComponentGetTag; text.Click += ComponentClick; } } }
- Assign current rendered business object in GetTag-EventHandler to StiValueEventArgs.Value
Code: Select all
void ComponentGetTag(object sender, Stimulsoft.Report.Events.StiValueEventArgs e) { e.Value = m_dataBand.BusinessObject.Current; }
- In Click-EventHandler use the TagValue of StiText
Code: Select all
void ComponentClick(object sender, System.EventArgs e) { StiText text = sender as StiText; if (!ReferenceEquals(text, null)) { string tagValueString= text.TagValue.ToString(); MessageBox.Show(tagValueString); } }
Thorsten Pontow
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)