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

Access report fields from a Table item

1 Answer 288 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Aplicativos
Top achievements
Rank 1
Aplicativos asked on 16 Nov 2015, 05:47 PM

hello I want to  Access report fields from a Table item and I've tried the follow example as in the http://www.telerik.com/help/reporting/faq-accessing-items.html

 

 Private Sub tabelaLivroPonto_ItemDataBinding(sender As Object, e As EventArgs) Handles tabelaLivroPonto.ItemDataBinding

        'get the textbox from the sender object            
        Dim textBox As Telerik.Reporting.Processing.TextBox = DirectCast(sender, Telerik.Reporting.Processing.TextBox)
        'get the table object
        Dim table As Telerik.Reporting.Processing.Table = DirectCast(textBox.Parent, Telerik.Reporting.Processing.Table)
        'get the detail section
        Dim detail As Telerik.Reporting.Processing.DetailSection = DirectCast(table.Parent, Telerik.Reporting.Processing.DetailSection)
        'get the raw value from the Report datasource directly
        textBox.Value = detail.DataObject("DiaSemana")
        MsgBox(textBox.Value)

    End Sub

 

but I got the follow error in my reportviewer

"An erro has ocurred while processing table "tabelaLivroPonto" <- my table

Unable to cast object of type 'Telerik.Reporting.Processing.Table' to type 'Telerik.Reporting.Processing.TextBox'

 

Please, someone could help me?

ty

 

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 17 Nov 2015, 03:40 PM
Hello Aplicativos,

The event is raised by the tabelaLivroPonto table item. The sender argument will contain the tabelaLivroPonto table item. It is not possible to cast the sender to a Telerik.Reporting.Processing.TextBox, as it is a Table item:
'incorrect
Dim textBox As Telerik.Reporting.Processing.TextBox = DirectCast(sender, Telerik.Reporting.Processing.TextBox)
 
'correct
Dim table As Telerik.Reporting.Processing.Table = DirectCast(sender, Telerik.Reporting.Processing.Table)


Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Aplicativos
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or