Solved

Display a color-coded project status

Posted on 2007-11-29
10
603 Views
Last Modified: 2008-02-01
Dear .net Gurus,

I need your urgent assistance.

I have been tasked with building a so-called "Simple" project tracker.

I would like Projects grouped like this:

Department HR     Status              Color
Project A         Unassiged         Gainsboro
Project B         Pending           Yellow
Project C         Completed         Green
Project D         Past Due          Red
Prject F             Closed            Purple

Department IT       Status           Color
Project A           Unassiged         Gainsboro
Project B             Pending           Yellow
Project C             Completed         Green
Project D             Past Due          Red
Prject F              Closed            Purple

This will list all departments with all of its projects and status and color-coded status.

To get the details, a user would click on the particular project view such details as startdate, completion date, requestedcompletion date, actual completition date, status, priority, etc.

Can I get some help with how to code this please?
0
Comment
Question by:nigerman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 3

Expert Comment

by:PierreBeukes
ID: 20380008
Hi,

In the table you are going to store your projects - you will have a status field. this will be numeric..
0 = Unassiged
1 = Pending
2 = Completed
3 = Past Due
4 = Closed

You can also have a table called something like app_status..
Where you can store the numeric value and the text value ... like above .... - you can also put a column in there for colour...

So when you load your projects  - you will be able to pickup the text value of the status and assign the appropriate colour...
What is nice is that if you store the colour in the table like that - if you want to change it - you change it in the Database and it will show the new colour all over (You can build a settings page to select the colours per status).

Thanks,
P
0
 

Author Comment

by:nigerman
ID: 20382505
Thanks very much for your response.

What we don't want to do is have a user select colors by themselves.

I love your idea of having a fieldname called Color in status table but I needed, if possible, the syntax for displaying this info.

For instance:

Select projectName, Status, color from Project, Status where project.statusid = status.statusid

Can you please help me with the .net syntax? I use vb but c# is ok too.
0
 

Author Comment

by:nigerman
ID: 20383572
Here is an example of what I am talking about.

The following code works as fars retrieving info and displaying.

On the summary page, StatusColor is displaying as Red, or White, Blue, depending on the status.

What I am having problem accomplishing is changing the color from text to the background color.

In other words, instead of reading Red, I want to see background color of Red displayed.

Can you please assist?

here is what I have so far:

        Private Function GetTasks() As DataSet
            Dim SQLStatement As String = "SELECT Project_ID,projName, DepartmentName, StatusName, StatusColor FROM tblProjects, tblStatus, tblDepartments Where tblProjects.statusID = tblStatus.StatusID and tblProjects.DeptID = tblDepartments.DepartmentID GROUP BY DepartmentName,ProjName,StatusName,project_id,statusColor ORDER BY DepartmentName"

            'instantiate sql connection and command object
            Dim myConnection As New SqlConnection("data source = Localhost;initial catalog = TaskList;Integrated Security=SSPI;")
            Dim myCommand As SqlDataAdapter = New SqlDataAdapter(SQLStatement, myConnection)

            '/declare myDataSet as DataSet
            Dim myDataSet As DataSet
            Dim RcdCount As Integer

            ' mark the Command as s Text
            myCommand.SelectCommand.CommandType = CommandType.Text

            '/create an instance of dataset
            myDataSet = New DataSet

            '/fill the dataset with returned records
            myCommand.Fill(myDataSet, "Contact")
            RcdCount = myDataSet.Tables("Contact").Rows.Count.ToString()
            'MyDataGrid.PageSize = CInt(ps.SelectedItem.Value)
            ResultCount = RcdCount
            RecordCount.Text = "<b><font color=red>" & RcdCount & "</font> records found"

            '/finally return dataset
            Return myDataSet
        End Function
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:nigerman
ID: 20386035
Can anyone please jump in and help???
0
 
LVL 3

Expert Comment

by:PierreBeukes
ID: 20393751
Hi,

Sorry for replying so late.
Ok - I see you created a function GetTasks() to return a Dataset to you.
Do you want to show the details in a gridview (I will assume this for now)...
so after you get the dataset...
you will bind it to a gridview

        GridView1.DataSource = GridDs
        GridView1.DataBind()

Add the RowDataBound event to the gridview

This is how mine looks like

    Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound

        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim c As System.Drawing.Color
            c = System.Drawing.ColorTranslator.FromHtml(e.Row.DataItem("StatusColour"))
            e.Row.BackColor = c
        End If
    End Sub



I have a column called StatusColour in my table with the values in html format  -> #b3424a

This works as it colours the entire row the colour which is specified in the database ... you can apply it to a column only if you wish...

Let me know if this works for you :)

Ciao
0
 

Author Comment

by:nigerman
ID: 20441011
Thanks a lot and sorry for late response.

I wanted it for datagrid, Can it be changed for datagrid?
0
 
LVL 3

Expert Comment

by:PierreBeukes
ID: 20447718
Are you working with Vb.NET  or ASP.NET?????
0
 

Author Comment

by:nigerman
ID: 20449206
asp.net, vb flavor
0
 
LVL 3

Accepted Solution

by:
PierreBeukes earned 100 total points
ID: 20455480
Then my above solution should work for you -> Just drag on a gridview
0
 

Author Comment

by:nigerman
ID: 20486651
thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question