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

D

djc

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!
 
E

Eliyahu Goldin

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
 
D

djc

I will. Thanks!

Eliyahu Goldin said:
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

do
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top