how/where to put logic to format certian columns/cells

Discussion in 'ASP .Net Datagrid Control' started by djc, Nov 2, 2004.

  1. djc

    djc Guest

    how do I go about formatting output of certian columns or cells in a
    datagrid? I am in the midst of trying to learn both asp.net/ado.net and TSQL
    stored procedure at the same time, all in my 'spare' time since its a hobby
    rather than a job... right now at least. Major overload! can someone point
    me in the right direction?

    1) My first use for this is to format the output of one of my datagrid
    columns that displays a date like this mm/dd/yyyy hh:mm:ss am/pm to display
    it like this mm/dd/yyyy. I believe there is a vb method .ToShortDate()? do I
    use that? The biggest question on this is WHERE/WHEN do I use it? what
    event(s) should I use to do this? This scenario is not conditional... the
    whole column should be displayed like this.

    2) what about a conditional scenario? For example, on an individual cell
    level... like if a particular field/cell has a certian value THEN display
    the whole row in a different color? or show a certian icon in a different
    column IF a condition is met? HOW/WHEN/WHERE?

    any examples, direction, links, or input would be greatly appreciated.

    thanks!
    djc, Nov 2, 2004
    #1
    1. Advertising

  2. Most flexible solution for both of your tasks is using ItemDataBound event
    handler in code-behind. Over there you have full programmatic access to the
    grid cells. You can check value of one cell and apply formatting to another.
    You can also format cells unconditionally. That is the direction You will
    greatly benefit if you explore the details yourself.

    Eliyahu

    "djc" <> wrote in message
    news:...
    > how do I go about formatting output of certian columns or cells in a
    > datagrid? I am in the midst of trying to learn both asp.net/ado.net and

    TSQL
    > stored procedure at the same time, all in my 'spare' time since its a

    hobby
    > rather than a job... right now at least. Major overload! can someone point
    > me in the right direction?
    >
    > 1) My first use for this is to format the output of one of my datagrid
    > columns that displays a date like this mm/dd/yyyy hh:mm:ss am/pm to

    display
    > it like this mm/dd/yyyy. I believe there is a vb method .ToShortDate()? do

    I
    > use that? The biggest question on this is WHERE/WHEN do I use it? what
    > event(s) should I use to do this? This scenario is not conditional... the
    > whole column should be displayed like this.
    >
    > 2) what about a conditional scenario? For example, on an individual cell
    > level... like if a particular field/cell has a certian value THEN display
    > the whole row in a different color? or show a certian icon in a different
    > column IF a condition is met? HOW/WHEN/WHERE?
    >
    > any examples, direction, links, or input would be greatly appreciated.
    >
    > thanks!
    >
    >
    Eliyahu Goldin, Nov 2, 2004
    #2
    1. Advertising

  3. djc

    djc Guest

    I will. Thanks!

    "Eliyahu Goldin" <> wrote in message
    news:...
    > Most flexible solution for both of your tasks is using ItemDataBound event
    > handler in code-behind. Over there you have full programmatic access to

    the
    > grid cells. You can check value of one cell and apply formatting to

    another.
    > You can also format cells unconditionally. That is the direction You will
    > greatly benefit if you explore the details yourself.
    >
    > Eliyahu
    >
    > "djc" <> wrote in message
    > news:...
    > > how do I go about formatting output of certian columns or cells in a
    > > datagrid? I am in the midst of trying to learn both asp.net/ado.net and

    > TSQL
    > > stored procedure at the same time, all in my 'spare' time since its a

    > hobby
    > > rather than a job... right now at least. Major overload! can someone

    point
    > > me in the right direction?
    > >
    > > 1) My first use for this is to format the output of one of my datagrid
    > > columns that displays a date like this mm/dd/yyyy hh:mm:ss am/pm to

    > display
    > > it like this mm/dd/yyyy. I believe there is a vb method .ToShortDate()?

    do
    > I
    > > use that? The biggest question on this is WHERE/WHEN do I use it? what
    > > event(s) should I use to do this? This scenario is not conditional...

    the
    > > whole column should be displayed like this.
    > >
    > > 2) what about a conditional scenario? For example, on an individual cell
    > > level... like if a particular field/cell has a certian value THEN

    display
    > > the whole row in a different color? or show a certian icon in a

    different
    > > column IF a condition is met? HOW/WHEN/WHERE?
    > >
    > > any examples, direction, links, or input would be greatly appreciated.
    > >
    > > thanks!
    > >
    > >

    >
    >
    djc, Nov 2, 2004
    #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. =?Utf-8?B?U2FtYmE=?=

    Excluding certian pages from Forms authentication

    =?Utf-8?B?U2FtYmE=?=, Aug 1, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    453
    =?Utf-8?B?VmlqYXk=?=
    Aug 30, 2005
  2. Replies:
    0
    Views:
    522
  3. B Young
    Replies:
    2
    Views:
    543
    B Young
    Jan 20, 2004
  4. jacko
    Replies:
    0
    Views:
    447
    jacko
    Aug 1, 2008
  5. Joel Finkel

    Cells[].Text or Cells[].Controls[0]

    Joel Finkel, Sep 1, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    305
    Joel Finkel
    Sep 1, 2003
Loading...

Share This Page