and null fields

Discussion in 'ASP .Net' started by Tina, Oct 18, 2005.

  1. Tina

    Tina Guest

    in the itemDatabound event of a datagrid, both null fields and blank string
    come through as   in the e.items.cells field. Is there anyway to tell
    them apart?
    Thanks,
    T
    Tina, Oct 18, 2005
    #1
    1. Advertising

  2. Not really. The "&" character sequence is used in HTML table cells to
    ensure that all browsers will display the cell that is empty. Some browsers
    will not draw the cell if it has nothing in it.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    Ambiguity has a certain quality to it.

    "Tina" <> wrote in message
    news:...
    > in the itemDatabound event of a datagrid, both null fields and blank
    > string come through as &nbsp; in the e.items.cells field. Is there anyway
    > to tell them apart?
    > Thanks,
    > T
    >
    Kevin Spencer, Oct 19, 2005
    #2
    1. Advertising

  3. Tina

    Mythran Guest

    "Kevin Spencer" <> wrote in message
    news:...
    > Not really. The "&amp;" character sequence is used in HTML table cells to
    > ensure that all browsers will display the cell that is empty. Some
    > browsers will not draw the cell if it has nothing in it.
    >


    Kevin,

    I think you meant &nbsp; :)

    Mythran
    Mythran, Oct 19, 2005
    #3
  4. Tina

    Mythran Guest

    "Tina" <> wrote in message
    news:...
    > in the itemDatabound event of a datagrid, both null fields and blank
    > string come through as &nbsp; in the e.items.cells field. Is there anyway
    > to tell them apart?
    > Thanks,
    > T
    >


    Yes there is a way to tell...

    If e.Item.ItemType <> ListItemType.Footer AndAlso _
    e.Item.ItemType <> ListItemType.Header AndAlso _
    e.Item.ItemType <> ListItemType.Separator AndAlso _
    e.Item.ItemType <> ListItemType.Pager

    ' If the data item is a data set, use the following :
    Dim ds As DataSet = DirectCast(e.Item.DataItem, DataSet)

    ' If it's a data table, use the following :
    Dim dt As DataTable = DirectCast(e.Item.DataItem.Row, DataRow)
    End If

    HTH :)

    Mythran
    Mythran, Oct 19, 2005
    #4
  5. Tina

    Tina Guest

    FYI, I received an execellent solution over in the datagrid forum...

    simply look in the source dataset to tell the difference! It's always easy
    once you know how.

    T

    "Kevin Spencer" <> wrote in message
    news:...
    > Not really. The "&amp;" character sequence is used in HTML table cells to
    > ensure that all browsers will display the cell that is empty. Some
    > browsers will not draw the cell if it has nothing in it.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > Ambiguity has a certain quality to it.
    >
    > "Tina" <> wrote in message
    > news:...
    >> in the itemDatabound event of a datagrid, both null fields and blank
    >> string come through as &nbsp; in the e.items.cells field. Is there
    >> anyway to tell them apart?
    >> Thanks,
    >> T
    >>

    >
    >
    Tina, Oct 19, 2005
    #5
  6. By golly, you're right! Hey, it was 6 AM, what can I say?

    --
    ;-),

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    Ambiguity has a certain quality to it.

    "Mythran" <> wrote in message
    news:...
    >
    > "Kevin Spencer" <> wrote in message
    > news:...
    >> Not really. The "&amp;" character sequence is used in HTML table cells to
    >> ensure that all browsers will display the cell that is empty. Some
    >> browsers will not draw the cell if it has nothing in it.
    >>

    >
    > Kevin,
    >
    > I think you meant &nbsp; :)
    >
    > Mythran
    >
    Kevin Spencer, Oct 19, 2005
    #6
  7. Tina

    Mythran Guest

    "Kevin Spencer" <> wrote in message
    news:%...
    > By golly, you're right! Hey, it was 6 AM, what can I say?
    >
    > --
    > ;-),
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > Ambiguity has a certain quality to it.
    >
    > "Mythran" <> wrote in message
    > news:...
    >>
    >> "Kevin Spencer" <> wrote in message
    >> news:...
    >>> Not really. The "&amp;" character sequence is used in HTML table cells
    >>> to ensure that all browsers will display the cell that is empty. Some
    >>> browsers will not draw the cell if it has nothing in it.
    >>>

    >>
    >> Kevin,
    >>
    >> I think you meant &nbsp; :)
    >>
    >> Mythran
    >>

    >
    >


    Your forgiven...and who's this "golly" fella? Do I want to know? :p

    Mythran
    Mythran, Oct 19, 2005
    #7
    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. =?Utf-8?B?Q2FsdmluIEtE?=

    How to display blank instead of &nbsp; in BoundColumn if null

    =?Utf-8?B?Q2FsdmluIEtE?=, Jul 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,661
    =?Utf-8?B?bG9uZG9uIGNhbGxpbmc=?=
    Jul 8, 2005
  2. Robert Kattke
    Replies:
    0
    Views:
    427
    Robert Kattke
    Dec 31, 2003
  3. Douglas J. Badin

    &nbsp; is not generated for null values when using a format string

    Douglas J. Badin, Dec 2, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    194
    Jeffrey Tan[MSFT]
    Dec 4, 2003
  4. Tina

    &nbsp; and null fields in a datagrid

    Tina, Oct 18, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    249
    S.M. Altaf [MVP]
    Oct 19, 2005
  5. hotkitty

    Parsing CSV and "&nbsp;&nbsp;"

    hotkitty, Oct 9, 2008, in forum: Perl Misc
    Replies:
    9
    Views:
    322
Loading...

Share This Page