How do I add a dataset to ViewState

Posted on 2005-05-04
Last Modified: 2011-08-18
Right now I have this code.

private void BindTextBoxes()

But I get this error at run time

Object reference not set to an instance of an object.  I think ViewState is the answer but I'm not sure how to add a dataset to ViewState.

Question by:sean-keys
    LVL 15

    Expert Comment


    r u missing [ after Columns

    Author Comment

    private void BindTextBoxes()

    That’s the actual code, not the debug output.

    LVL 14

    Accepted Solution

    Hey, Sean.

    I know VB.NET better than C# but i think it will be easy to understand:

    To store data into ViewState use this:

    To retrieve what you have stored use this:
    Dim T_Customers as New DataTable
    T_Customers=CType(Me.Viewstate("t_customers"), DataTable)

    Hope this will help
    Good luck

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now