I have a page (1) with 2 grids. In grid1 you see the projects. When clicking on a project you see the Bewerkingen with images based on their status in grid2. Below each image you see the value of a counter. The status of each Bewerking depends on the enddate of the Task and todays date. Each status has a counter (teller).
P.E.
Project 1; task1; bewerking1; image1; counter1
Project 1; task2; bewerking2; image2; counter2
Project 1; task3; bewerking1; image1; counter1
Project 2; task1; bewerking1; image3; counter3
When you click on Project 1 in grid1 you will see in grid2 the figure 2 below image1 and the figure 1 below image2.
When you click on an image in grid2 a new page (2) opens an the details of the tasks will be shown.
There is my problem. The grid shows all tasks.
The code of page1
And the code of page2
P.E.
Project 1; task1; bewerking1; image1; counter1
Project 1; task2; bewerking2; image2; counter2
Project 1; task3; bewerking1; image1; counter1
Project 2; task1; bewerking1; image3; counter3
When you click on Project 1 in grid1 you will see in grid2 the figure 2 below image1 and the figure 1 below image2.
When you click on an image in grid2 a new page (2) opens an the details of the tasks will be shown.
There is my problem. The grid shows all tasks.
The code of page1
| Public Function Active(ByVal PROJECTID As String, ByVal BEWERKINGID As String) As String | |
| Dim tellernull As Integer = 0 | |
| Dim tellerrood As Integer = 0 | |
| Dim telleroranje As Integer = 0 | |
| Dim tellergroen As Integer = 0 | |
| Dim datum As String = Now.ToShortDateString | |
| Dim retstring As String = "" | |
| Dim strSQL As String = "Select * from tblTasks where ProjectId = @ProjectId and BewerkingId=@BewerkingId and ReadyDate IS NULL" | |
| Dim command As New SqlCommand(strSQL) | |
| command.Parameters.AddWithValue("@ProjectId", PROJECTID) | |
| command.Parameters.AddWithValue("@BewerkingId", BEWERKINGID) | |
| Dim dr As SqlDataReader = DBPortal.OpenReader(command) | |
| While dr.Read | |
| If dr("EstimatedReadyDate") Is DBNull.Value Then | |
| tellernull += 1 | |
| Else | |
| 'begin eigen test code | |
| Dim EstimatedReadyDate As Date = dr("EstimatedReadyDate") | |
| Dim task As Integer = dr("TaskId") | |
| Dim TimeSpan As TimeSpan | |
| Dim NumberOfDays As Integer | |
| TimeSpan = EstimatedReadyDate.Subtract(Now) | |
| NumberOfDays = TimeSpan.Days | |
| If NumberOfDays <= 5 Then | |
| tellerrood += 1 | |
| Else | |
| If NumberOfDays >= 6 And NumberOfDays <= 10 Then | |
| telleroranje += 1 | |
| Else | |
| tellergroen += 1 | |
| End If | |
| End If | |
| End If | |
| End While | |
| dr.Close() | |
| retstring = "null " + tellernull.ToString + ", " + tellergroen.ToString + ", " + telleroranje.ToString + ", " + tellerrood.ToString | |
| Dim trow1 As String = "<tr>" | |
| Dim trow2 As String = "<tr>" | |
| If tellernull > 0 Then | |
| trow1 += "<td style='border: 0px'><a href='ShowDetails.aspx?projectid=" + PROJECTID.Trim + "&bewerkingid=" + BEWERKINGID.Trim + "&soort=nullact'><img src='images/bluelight_cross.png' border='0' alt='no enddate'></a></td>" | |
| trow2 += "<td style='border: 0px' align='center'>" + tellernull.ToString + "</td>" | |
| End If | |
| If tellerrood > 0 Then | |
| trow1 += "<td style='border: 0px'><a href='ShowDetails.aspx?projectid=" + PROJECTID.Trim + "&bewerkingid=" + BEWERKINGID.Trim + "&soort=roodact'><img src='images/redlight.png' border='0' alt='critical'></a></td>" | |
| trow2 += "<td style='border: 0px' align='center'>" + tellerrood.ToString + "</td>" | |
| End If | |
| If telleroranje > 0 Then | |
| trow1 += "<td style='border: 0px'><img src='images/orangelight.png' alt='almost critical'></td>" | |
| trow2 += "<td style='border: 0px' align='center' >" + telleroranje.ToString + "</td>" | |
| End If | |
| If tellergroen > 0 Then | |
| trow1 += "<td style='border: 0px'><img src='images/greenlight.png' alt='on schedule'></td>" | |
| trow2 += "<td style='border: 0px' align='center'>" + tellergroen.ToString + "</td>" | |
| End If | |
| trow1 += "</tr>" | |
| trow2 += "</tr>" | |
| retstring = "<table style='border: 0px'>" + trow1 + trow2 + "</table>" | |
| Return retstring | |
| End Function | |
| Public Function Finished(ByVal PROJECTID As String, ByVal BEWERKINGID As String) As String | |
| Dim tellernull As Integer = 0 | |
| Dim tellerrood As Integer = 0 | |
| Dim telleroranje As Integer = 0 | |
| Dim tellergroen As Integer = 0 | |
| Dim datum As String = Now.ToShortDateString | |
| Dim retstring As String = "" | |
| Dim strSQL As String = "Select * from tblTasks where ProjectId = @ProjectId and BewerkingId=@BewerkingId and ReadyDate IS NOT NULL" | |
| Dim command As New SqlCommand(strSQL) | |
| command.Parameters.AddWithValue("@ProjectId", PROJECTID) | |
| command.Parameters.AddWithValue("@BewerkingId", BEWERKINGID) | |
| Dim dr As SqlDataReader = DBPortal.OpenReader(command) | |
| While dr.Read | |
| If dr("EstimatedReadyDate") Is DBNull.Value Then | |
| tellernull += 1 | |
| Else | |
| 'begin eigen test code | |
| Dim EstimatedReadyDate As Date = dr("EstimatedReadyDate") | |
| Dim task As Integer = dr("BewerkingId") | |
| Dim TimeSpan As TimeSpan | |
| Dim NumberOfDays As Integer | |
| TimeSpan = EstimatedReadyDate.Subtract(Now) | |
| NumberOfDays = TimeSpan.Days | |
| If NumberOfDays <= 5 Then | |
| tellerrood += 1 | |
| Else | |
| If NumberOfDays >= 6 And NumberOfDays <= 10 Then | |
| telleroranje += 1 | |
| Else | |
| tellergroen += 1 | |
| End If | |
| End If | |
| End If | |
| End While | |
| dr.Close() | |
| retstring = "null " + tellernull.ToString + ", " + tellergroen.ToString + ", " + telleroranje.ToString + ", " + tellerrood.ToString | |
| Dim trow1 As String = "<tr>" | |
| Dim trow2 As String = "<tr>" | |
| If tellernull > 0 Then | |
| trow1 += "<td style='border: 0px'><a href='ShowDetails.aspx?projectid=" + PROJECTID.Trim + "&bewerkingid=" + BEWERKINGID.Trim + "&soort=nullfin'><img src='images/bluelight_cross.png' border='0' alt='no enddate'></a></td>" | |
| trow2 += "<td style='border: 0px' align='center'>" + tellernull.ToString + "</td>" | |
| End If | |
| If tellerrood > 0 Then | |
| trow1 += "<td style='border: 0px'><a href='ShowDetails.aspx?projectid=" + PROJECTID.Trim + "&bewerkingid=" + BEWERKINGID.Trim + "&soort=roodfin'><img src='images/redlight.png' border='0' alt='critical'></a></td>" | |
| trow2 += "<td style='border: 0px' align='center'>" + tellerrood.ToString + "</td>" | |
| End If | |
| If telleroranje > 0 Then | |
| trow1 += "<td style='border: 0px'><img src='images/orangelight.png' alt='almost critical'></td>" | |
| trow2 += "<td style='border: 0px' align='center' >" + telleroranje.ToString + "</td>" | |
| End If | |
| If tellergroen > 0 Then | |
| trow1 += "<td style='border: 0px'><img src='images/greenlight.png' alt='on schedule'></td>" | |
| trow2 += "<td style='border: 0px' align='center'>" + tellergroen.ToString + "</td>" | |
| End If | |
| trow1 += "</tr>" | |
| trow2 += "</tr>" | |
| 'retstring = "<table style='border: 0px'>" + trow1 + trow2 + "</table>" | |
| retstring = "<table border='0'>" + trow1 + trow2 + "</table>" | |
| Return retstring | |
| End Function |
And the code of page2
| Protected Sub gvShowDetail_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gvShowDetail.ItemDataBound | |
| Dim strid As String = "" | |
| Dim BewerkingId As String | |
| Dim Projectid As String | |
| BewerkingId = Request.QueryString("BewerkingId") | |
| ProjectId = Request.QueryString("ProjectId") | |
| Dim strSQL As String = "Select * from tblTasks where (ProjectId = @ProjectId) AND (BewerkingId = @BewerkingId)" | |
| Dim command As New SqlCommand(strSQL) | |
| command.Parameters.AddWithValue("@ProjectId", ProjectId) | |
| command.Parameters.AddWithValue("BewerkingId", BewerkingId) | |
| Dim dr As SqlDataReader = DBPortal.OpenReader(command) | |
| While dr.Read | |
| If dr("EstimatedReadyDate") Is DBNull.Value Then | |
| strid = "" | |
| Else | |
| If dr("ReadyDate") Is DBNull.Value Then | |
| Dim EstimatedReadyDate As Date = dr("EstimatedReadyDate") | |
| Dim task As Integer = dr("TaskId") | |
| Dim TimeSpan As TimeSpan | |
| Dim NumberOfDays As Integer | |
| Dim Soort As String | |
| Dim retstring As String = "" | |
| Soort = Request.QueryString("soort") | |
| TimeSpan = EstimatedReadyDate.Subtract(Now) | |
| NumberOfDays = TimeSpan.Days | |
| If Soort = "roodact" Then | |
| If NumberOfDays <= 5 Then | |
| 'roodact | |
| BewerkingId = Request.QueryString("BewerkingId") | |
| ProjectId = Request.QueryString("ProjectId") | |
| Dim strSQLRoodAct As String = "Select * from tblTasks where (ProjectId = @ProjectId) AND (BewerkingId = @BewerkingId)" | |
| Dim commandRoodact As New SqlCommand(strSQLRoodAct) | |
| commandRoodact.Parameters.AddWithValue("@ProjectId", ProjectId) | |
| commandRoodact.Parameters.AddWithValue("BewerkingId", BewerkingId) | |
| Dim drRoodAct As SqlDataReader = DBPortal.OpenReader(commandRoodact) | |
| drRoodAct.Close() | |
| End If | |
| End If | |
| End If | |
| End If | |
| End While | |
| dr.Close() | |
| End Sub | |