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

how to set subreport visible accordingly

3 Answers 155 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 08 Jan 2008, 10:33 PM
If I have a textbox_ItemDataBound and subreport_ItemDataBound in the detail section, the subreport_ItemDataBound always run first, and then the textbox_ItemDataBound run.  Is there any way I can run the textbox_ItemDataBound first?

I want to get the value of the textbox from the textbox_ItemDataBound to set the visibility of subreport according the value of the textbox's value.

3 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 09 Jan 2008, 02:59 PM
Hello Steven,

The order ItemDataBound (and ItemDataBinding) event handlers are called according to the Z-order of the report items - the top most item in Z-order is related with the 1st raised event. This involves us in action with Bring to Front and Bring to Back commands from context menu:


Current Z-order of report items can be previewed with Report Explorer.

Best wishes,
Ivan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Steven
Top achievements
Rank 1
answered on 09 Jan 2008, 08:54 PM
Greaat thanks, I got your idea. But when I click Bring to Front on a textbox, this textbox will go to the bottom in its section, and if I click Bring to Back, it will go to the top in its section. Is this correct? It looks strange this way.
0
Ivan
Telerik team
answered on 10 Jan 2008, 01:35 PM
Hello Steven,

About commands names it is just our point of view. Really we named them in this way because of the draw effect and names are not related to the Z-order. For example the bottom-most item (in Z-order list) is drawn last and in fact it is at the visible front, on other side is the top-most item - it is drawn first and all the other items can overwrite it, i.e. the top-most item in the Z-order is the back-most item in the Draw process.

Returning to the core of your first question let me mention that using the Bring to Top/Back commands is convenient only for small collections. In general you can implement the ItemDataBound event handler of items' parent - for example the Detail section, and inside this handler you can do all the modifications you are looking for. For example preview the following detail-section's handler:

private void detail_ItemDataBound(object sender, System.EventArgs e) 
    Telerik.Reporting.Processing.DetailSection section = 
        sender as Telerik.Reporting.Processing.DetailSection; 
    if(null != section) 
    { 
        Telerik.Reporting.Processing.TextBox textBox = 
            section.Items["textBox1"as Telerik.Reporting.Processing.TextBox; 
        Telerik.Reporting.Processing.SubReport subReport = 
            section.Items["subReport1"as Telerik.Reporting.Processing.SubReport; 
        // here we can deal with textBox and subReport... 
    } 

I hope this information will help.

Regards,
Ivan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Steven
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Steven
Top achievements
Rank 1
Share this question
or