Web Form DataGrid not displaying - please help me!!!

Discussion in 'ASP .Net' started by almurph, Jun 29, 2007.

  1. almurph

    almurph Guest


    This is weird, please help. Its probably very simple but I'm stuck! I
    have populated a dataset with some data from a session variable:

    Dim dsTables As DataSet = Session("soLookupTables")

    And now I am trying to display it to a DataGrid widget using the
    following code:

    Dim myTable As DataTable = dsTables.Tables("CNTYNAMES")
    Me.DataGrid1.DataSource = myTable.DefaultView

    Problem is though - nothing is appearing o nthe Web form page. I've
    tried everything

    a. try-catches (no errors thrown)
    b. Closing down and opening up (no change)
    c. DataGrid properties - everything looks okay

    There is definitely data in the dataset. 2 tables to be exact. In the
    one specified there are 16 rows. I have used code like:

    Me.Label1.Text = dsTables.Tables("CNTYNAMES").Rows(0).Item(0)

    and have seens some sensible data. I just don't know why the DataGrid
    is not displaying. Please help me I'm stuck!!!

    almurph, Jun 29, 2007
    1. Advertisements

  2. almurph

    Mike Guest

    do you have data in your dataset?
    to check that you can do


    and then you can open the XML file and verify you are getting data back.

    try that and see what happens,
    Mike, Jun 29, 2007
    1. Advertisements

  3. almurph

    Mike Guest

    I don't see


    in your code snippet

    what happens?
    Mike, Jun 29, 2007
  4. almurph

    Mark Rae Guest

    You have done the first two stages of the three that are required here:

    1) Instantiated a DataSet
    2) Told your DataGrid that it will be using the DataSet as its DataSource

    What you haven't done is actually bind the data to the DataGrid:
    Mark Rae, Jun 29, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.