How to pass a Datatable back from a user control to its hosting page?

Posted on 2006-05-02
Medium Priority
Last Modified: 2012-06-27
How to pass a Datatable back from a user control to its hosting page?

I added a property in my user control page:

    Private objDataTable as DataTable

    .... set objDataTable value somewhere ....

    Public ReadOnly Property Shipments() As DataTable
            Return objDataTable
        End Get
    End Property

On hosting page, I used ucShip to refer my User Control, and tried to get the DataTable:
    Dim oTable as DataTable = ucShip.Shipments

Got error "object variable or with block variables not set"

Please help!
Question by:dshi15
1 Comment

Accepted Solution

pauljk1619 earned 1500 total points
ID: 16588770
You need to use find control to get ucShip.
Dim oTable as DataTable
Dim ucShip as System.Web.UI.Control
ucShip = Me.FindControl("WhatEverTheNameISofYourUserControl");
if not isNothing(ucShip) then
    DataTable = ucShip.Shipments
end if

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question