DataGrid

Discussion in 'Programming' started by stevejhon, Oct 7, 2008.

  1. #1
    Hi,
    My DataGrid initially doesn't have any data to which I 've added some functionality to add rows of data dynamically. Since my Datatable which binds to the Grid initially is empty, my DataGrid doesn't show up on the page. Is there as way to show the header and footer templates in the absence of any data in the Grid??
    Any help apreciated.

    thanks
     
    stevejhon, Oct 7, 2008 IP
  2. jgarrison

    jgarrison Peon

    Messages:
    66
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Here is one way:

    http://weblogs.asp.net/

    Another way to change your SQL statement like so:

    SELECT ColumnA, ColumnB, ColumnC, ColumnD FROM [tablename] WHERE ([somefield]= @someparameter)
    UNION ALL
    SELECT '', '', '', '' FROM [tablename] WHERE ([somefield]= @someparameter) HAVING COUNT(*) = 0

    That will return empty fields if no rows are found in your query.

    -Jim
     
    jgarrison, Oct 8, 2008 IP