Results 1 to 3 of 3

Thread: Setup Datagrid

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    Setup Datagrid

    Is there any way I can setup my datagrid to only display values that are not null?

    For instance...
    if I have the items and values below:

    Name: John Smith
    Age: NULL
    Location: USA
    SSN: NULL

    Name: Jim Carter
    Age: 72
    Location: USA
    SSN: NULL

    Name: Dick Smith
    Age: 80
    Location: Germany
    SSN: NULL

    I only want my datagrid to show the following

    Name Age Location

    because all of the SSN's are NULL

    If a datagrid won't do this, then is there a way to display my data that would?

    Thanks,

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  2. #2
    Junior Member
    Join Date
    Feb 2005
    Posts
    17

    Re: Setup Datagrid

    Hi there,

    I assume here that your datagrid is based upon the results returned for a query pertaining to your database. Now let us say you have a table named
    "tblInfo" with fields such as Name, Age, Location and SSN.

    Now according to your condition all the SSNs are null. So you can do this

    use query like " Select tblInfo.Name, tblInfo.Age, tblInfo.Location from tblInfo"

    and you will get a set of results which you can display in the datagrid.

    Remember if you do not want to display SSNs then make sure that datagrid have only three columns by column names as Name, Age, Location

    Hope this helps, any other input on this will be highly appriciated

    -vikram

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    Re: Setup Datagrid

    I was just wondering if there were any way for the datagrid itself to exclude (hide) columns that contain only null values. I know that I will need to use an SQL statement and setup a datatable to put data into the grid but I don't want to show my user any data fields that basically aren't being used. I won't know if they're being used or not, that's based upon data being pulled in from another source, but I have to make them available when the data is being imported, but not necessarily show the empty fields when I'm displaying the data.

    How can I know if a column is filled with null values?

    Thanks,

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

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