Results 1 to 4 of 4

Thread: datagrid not visible

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    Connecticut
    Posts
    257

    datagrid not visible

    I am new to asp .net and i'm trying to create a simple web form with a datagrid to display data. I put the data grid on the form, created all the database connections, etc. and bound the data, but when I build and browse the datagrid is not visible. Is there a simple answer?

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    This usually happens when your datasource is Nothing.

    Check to make sure you are getting data back in the datasource you are binding to.

    Another mistake that I have done in the past is bind a dataset, instead of one of the tables in the dataset.

  3. #3
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    I am having the same problem
    I can't figure it out.
    I have a Database class called Database, that just returns datasets for any given SQL SELECT statement.
    This works.

    I have:
    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         Dim ds As DataSet
    3.         Dim db As New Database
    4.         ds = db.GetDataSet("SELECT * FROM Users")
    5.         grdUsers.DataSource = ds
    6.     End Sub
    When I do:
    Code:
    ? ds.Tables.Item(0).Rows.Count
    Then it returns a 1, which is correct. I have 1 user in my table.
    But the datagrid is just not visible
    I have tried the above and:
    VB Code:
    1. grdUsers.DataSource = ds.Tables(0)
    Yet I still can't see the table

    Wopka

  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width