DataGrid

Discussion in 'ASP .Net' started by johnpeter887@hotmail.com, May 10, 2006.

  1. Guest

    i have simple question. i am trying to view a table contents in a data
    grid in a .aspx page, i can see the contents if i write the code in the
    page load function.

    But when i use the drag and drop approach Grid doesn't show anyting.
    I drop a dataadapter on the web form connect it to the datasource,
    write the select statement, then generate a dataset and then connect
    this dataset to the DataGrid. I can see the column names in the
    designer but nothing when i run it.

    Any suggestions.
     
    , May 10, 2006
    #1
    1. Advertising

  2. Is your code setting the DataSource property of the grid and then calling
    it's DataBind method?
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "" wrote:

    > i have simple question. i am trying to view a table contents in a data
    > grid in a .aspx page, i can see the contents if i write the code in the
    > page load function.
    >
    > But when i use the drag and drop approach Grid doesn't show anyting.
    > I drop a dataadapter on the web form connect it to the datasource,
    > write the select statement, then generate a dataset and then connect
    > this dataset to the DataGrid. I can see the column names in the
    > designer but nothing when i run it.
    >
    > Any suggestions.
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, May 10, 2006
    #2
    1. Advertising

  3. Guest

    This is what i am doing in my code and it works.......but doesn't work
    when i don't write any code and just the follow the drag n drop
    approach.

    SqlConnection myConn = new SqlConnection("connection string");
    SqlDataAdapter myAdap = new SqlDataAdapter("Query", myConn);
    DataSet ds = new DataSet();
    myAdap.Fill(ds, "TableName");
    DataGrid1.DataSource=ds.Tables["TableName"];
    DataGrid1.DataBind();
     
    , May 10, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
    Replies:
    0
    Views:
    449
  2. BK Kim

    datagrid in datagrid

    BK Kim, Feb 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    543
    Alvin Bruney [MVP]
    Mar 2, 2004
  3. =?Utf-8?B?U3VyZXNo?=
    Replies:
    0
    Views:
    526
    =?Utf-8?B?U3VyZXNo?=
    Mar 2, 2004
  4. Brian K. Williams
    Replies:
    0
    Views:
    545
    Brian K. Williams
    Mar 2, 2004
  5. Andreas Klemt
    Replies:
    0
    Views:
    309
    Andreas Klemt
    Oct 8, 2003
Loading...

Share This Page