nigerman
asked on
Display a color-coded project status
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?
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?
ASKER
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.
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.
ASKER
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.DepartmentI D GROUP BY DepartmentName,ProjName,St atusName,p roject_id, statusColo r 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(SQLStatemen t, myConnection)
'/declare myDataSet as DataSet
Dim myDataSet As DataSet
Dim RcdCount As Integer
' mark the Command as s Text
myCommand.SelectCommand.Co mmandType = 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.Cou nt.ToStrin g()
'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
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.DepartmentI
'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(SQLStatemen
'/declare myDataSet as DataSet
Dim myDataSet As DataSet
Dim RcdCount As Integer
' mark the Command as s Text
myCommand.SelectCommand.Co
'/create an instance of dataset
myDataSet = New DataSet
'/fill the dataset with returned records
myCommand.Fill(myDataSet, "Contact")
RcdCount = myDataSet.Tables("Contact"
'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
ASKER
Can anyone please jump in and help???
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(ByV al sender As Object, ByVal e As System.Web.UI.WebControls. GridViewRo wEventArgs ) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim c As System.Drawing.Color
c = System.Drawing.ColorTransl ator.FromH tml(e.Row. DataItem(" StatusColo ur"))
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
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(ByV
If e.Row.RowType = DataControlRowType.DataRow
Dim c As System.Drawing.Color
c = System.Drawing.ColorTransl
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
ASKER
Thanks a lot and sorry for late response.
I wanted it for datagrid, Can it be changed for datagrid?
I wanted it for datagrid, Can it be changed for datagrid?
Are you working with Vb.NET or ASP.NET?????
ASKER
asp.net, vb flavor
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
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