Dynamic DataGrid Column

Dynamic DataGrid Column

am 04.04.2006 16:30:02 von jharter

Can someone tell me how to accomplish this. Basically I have code here that
returns a datagrid that is queried from a database. One column however
contains data as to the state of a computer (error, critical, successful,
etc) and I would like to replace this column with a picture (i.e. a red X for
critical or a check for successful). So, the data in the column would
determine the picture used. For instance if the value = 10 then
successful.gif is shown. How can I accomplish this? My code is below:

<%@ Page Language="VB" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "System.Data.SQLClient" %>




ASP.NET Database Sort (with Arrows) Sample





Border = 0
CellSpacing = 1
width = "100%"

HeaderStyle-BackColor = "#CCCCCC"
HeaderStyle-ForeColor = "#000000"
HeaderStyle-Font-Bold = "True"
HeaderStyle-Font-Name = "Tahoma"
HeaderStyle-Font-Size = "8.25"

ItemStyle-BackColor = "#FFFFFF"
ItemStyle-Font-Name = "Tahoma"
ItemStyle-Font-Size = "8.25"
AlternatingItemStyle-BackColor = "GhostWhite"

AutoGenerateColumns = "False"
>














--
Justin Harter
::BLOG:: http://spaces.msn.com/members/jharter

Re: Dynamic DataGrid Column

am 04.04.2006 16:34:52 von reb01501

Justin Harter wrote:
> Can someone tell me how to accomplish this. Basically I have code
> here that returns a datagrid that is queried from a database. One
> column however contains data as to the state of a computer (error,
> critical, successful, etc) and I would like to replace this column
> with a picture (i.e. a red X for critical or a check for successful).
> So, the data in the column would determine the picture used. For
> instance if the value = 10 then successful.gif is shown. How can I
> accomplish this? My code is below:
>
There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.

There was a good 4Guys... series written by Scott mitchell from which I
learned how to do this. Let's see if i can find it ...
Ah!
http://aspnet.4guysfromrolla.com/articles/040502-1.aspx


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.