Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 grid always gray since change?

Author  Topic 

jhermiz

3564 Posts

Posted - 2004-10-06 : 13:30:58
I have a grid where I Was changing the background colors of rows in the ItemBound event and it was working great:


Private Sub dgIssues_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgIssues.ItemDataBound
'the ItemDatabound event triggers for each row of our data grid
'in our procedure we simply change the row's background color based on
'an issues open / closed / target date
'any closed task is given a mint creame color
'any open task is a light light blue color
'any over due task is a light pink color

'make sure you skip the header / footer of the grid
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

'if a space exists means the task is not closed
If e.Item.Cells(6).Text <> " " Then
'task closed
e.Item.BackColor = Color.Gainsboro
'handle task open AND overdue
ElseIf CType(e.Item.Cells(5).Text, Date) < Now Then
'task overdue
e.Item.BackColor = Color.Linen
Else
'open not overdue
e.Item.BackColor = Color.Azure
End If
End If
End Sub


THis worked great but I then found out that each row needed to be clickable. So I added the following to my html page:

#dgissues a{display:block;
height:100%;}

<asp:HyperLinkColumn DataNavigateUrlField="IssueID"
DataNavigateUrlFormatString="Details.aspx?IssueID={0}"

HeaderText="Comm." ItemStyle-Width="10%" DatatextField="Commission"
headerstyle-cssclass="RowType_DK"

SortExpression="2">

<ItemStyle Wrap="False"></ItemStyle>

</asp:HyperLinkColumn>


It makes the whole row CLICKABLE which is perfect, but now the coloring of each row is gray? Any idea on this ???

My second question is lets say Im using a user control as a footer. In the footer I have a label that should change based on the page that is loaded...
for instance when HOME page is opened I want the text on the footer to say HOME. When the page is on "LOG AN ISSUE" I want it to say LOG AN ISSUE on this bottom corner where this label is...
But is there a way to pass or call functions from say a default.aspx page to the vb code behind page of this footer ? I need to change this text every time the person goes to a new page, but this footer is not in the same vb code page as all these other pages.

I want to be able to do:
SetFooterLabel("Home")

or whatever and have it go to a SetFooterPage and call that label:

Me.lblFooter=strSomeString

So it takes that parameter and it assigns it to the label on my footer.

Hope I made sense, if not post back.

Thanks,
Jon

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 13:40:40
Grey rows Probably a CSS issue I can't help you any more than that without seeing the rendered output of the page.


Footer thing
I think if you create a public property / variable on the Page, and have the footer read Me.Page.PublicVarible.

Without seeing how you've got your project structured, it's hard to figure that one out.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 13:43:24
quote:
Originally posted by MichaelP

Grey rows Probably a CSS issue I can't help you any more than that without seeing the rendered output of the page.


Footer thing
I think if you create a public property / variable on the Page, and have the footer read Me.Page.PublicVarible.

Without seeing how you've got your project structured, it's hard to figure that one out.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>



Well Michael,

Basically the second problem is think of it like this. I have my own footer I use in each page. I want this watermark effect to read the page that I am currently looking at. So I placed a label on this footer. I want to be able to set the text in this label of this footer.vb.ascx file. So that whatever page I am on I can call a function from the On Page Load event of the page and say:
SetPageFooterText("Home")...etc
on each page. It should call this function which resides in the footer class page code behind and set that label. I dont know how else to do it ???
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-06 : 13:51:02
so use this code to set your footer:

YourPage.FooterLabel.Text = GetFooterText("Home")

and write the function GetFooterText to return the footer text required for all pages based on the argument passed, if that's how you'd like to do it.

- Jeff
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 13:52:54
quote:
Originally posted by jsmith8858

so use this code to set your footer:

YourPage.FooterLabel.Text = GetFooterText("Home")

and write the function GetFooterText to return the footer text required for all pages based on the argument passed, if that's how you'd like to do it.

- Jeff



But my footerlabel is in the footers code page behind..I cant refer to it in the other pages can I ? Where does this GetFooterText function get placed ?
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 13:54:23
If it helps the footer is in a file "footer.ascx"
The pages I want to set this on are aspx pages.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 14:00:43
Well you know how this is a class

class footer
blah blah
....
Public Function SetFooter(strFooter as String)
Me.lblFooter.Text = strFooter
End Function
End Class

I tried this in my default.aspx page I did
Dim f as New footer
f.SetFooter("blah")

But it does pass it and everythign but then this comes up:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 40: End Sub
Line 41: Public Function GetFooter(ByVal f As String)
Line 42: Me.lblFooterName.Text = f
Line 43: End Function
Line 44: End Class


Source File: \\Jakah-iis-2\ims\includes\footer.ascx.vb Line: 42

So it errors out ?
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 14:01:24
Well, you could easily drop something into session on the main page, and grab that variable in the footer page. Sorta expensive for what you are trying to do though. I think you have to do something in the footer to grab the variable from the page, and not push the value to the footer.

How is the footer added to the bottom of the page? If you can explain that or post some code that would be handy to help you figure this out.

Michael




<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 14:05:53
Hi Michael,

I still dont see why my sample is erorring out.
Think of this as an include in the old asp days...
its a user control in asp.net that I have. Its basically the footer
that I reuse on each page. So its a seperate .ascx file.

I simply drag and drop that footer into each page. On that .ascx file I have a label, lets call it lblFooter. So when I go to a home page I want it to read "Home". When I go to an admin page I want it to read "Admin" and so on...

So if this function is public why doesnt it work:

Dim f as New footer 'declare instance of the footer class
f.SetFooter("blah") 'call the setfootr function which is public and assign it blah

In class footer I have:

public function SetFooter(strFooter as String)
Me.lblFooter.Text = strFooter
end function

Am I missing something so simple here ?
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 14:13:54
I'm not 100% sure why you are getting that error, but i can assure you that even if that didn't blow up it still work not work for you. If you create a NEW footer, then you'd have two on that page. The one you "dragged and dropped" on and the one you created in code.

What I think you need to do is do a FindControl() in your page, and then set the value of the label accordingly.

Something like this:

'In the code behind of the ASPX file in question
Dim Footer as Myfooter

myFooter = FindControl("TheIDofMyFooter")

myFooter.lblFooter.text = "Admin"
'or you could call your SetFooter function



Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 14:21:24
Hmm what is myfooter?

Is it my footer.ascx file ?

If I do that :

Dim Footer As Footer

Footer = FindControl("lblFooterName")

Footer.lblFooter.text = "Admin"
'or you could call your SetFooter function

It doesnt know what lblFooter is ????
nor does it know what Footer.lblFooterName.text is.

Will FindControl find the control on an .ascx page calling that code from the .aspx page ? I don't see how that code makes any sense :(.
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 14:31:50
myFooter is the type / class of the footer.ascx

The control you need to find in FindControl() is the UserControl, and not the label on the UserControl.

Ok, here's an example of something I have that's like this.


'ASPX Page
<asp:panel id="pnlStep1" runat="server">
Stuff
</asp:panel>
<asp:panel id="pnlStep2" runat="server" visible="false">

More stuff
</asp:panel>




'In my code behind
Public Sub btnNextPage_Click(ByVal s As System.Object, ByVal e As System.EventArgs) Handles btnNext1.Click, btnNext2.Click, btnNext3.Click
Dim pnlPanel As Panel
Dim sPanelName As String

'Hide Previous Panel
sPanelName = "pnlStep" & ViewState("CurrentPage")
pnlPanel = FindControl(sPanelName)
pnlPanel.Visible = False

'Show Current Panel
ViewState("CurrentPage") += 1

sPanelName = "pnlStep" & ViewState("CurrentPage")
pnlPanel = FindControl(sPanelName)
pnlPanel.Visible = True

DataBind()

End Sub



Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 14:31:54
Made that variable public in the class...

tried this:


Dim myFooter As footer
myFooter = FindControl("lblFooterName")
myFooter.lblFooterName.Text = "TEST"


Got that same error:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 87: Dim myFooter As footer
Line 88: myFooter = FindControl("lblFooterName")
Line 89: myFooter.lblFooterName.Text = "TEST"
Line 90:
Line 91: strLoginUser = Session("Login")

Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 14:35:41
I am so confused...
maybe i should post my footer class:

footer.ascx:


Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.DataGrid
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Web.Mail
Imports System.Data.SqlTypes
Imports Microsoft.VisualBasic
Imports System.Web.UI.Page
Imports System.Web.Security
Imports System.Web.UI.UserControl

Public Class footer
Inherits System.Web.UI.UserControl
Protected WithEvents lblFooterName As System.Web.UI.WebControls.Label
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' lblFooterName.Text = "home"
End Sub
Public Function SetFooter(ByVal f As String)
Me.lblFooterName.Text = f
End Function
End Class


As you see there is nothing to this footer it has some images on it...and one label. The label is called lblFooterName. All I want to do is change it based on the page I am on...

Now lets say I have a default.aspx page...

I tried all of the things I have mentioned in my threads and I get nothing but errors. I cant seem to see how that posted example helps me Michael :(.

Surely this has to be something simple :(...cant believe its taking this long for me :(.

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 14:37:21
Post the ASPX and code behind for the default.aspx and I should be able to give you the solution.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 14:38:48
Code behind for default.aspx...
I dont see why anyone wants to see this..I just want to load this text string in the page load event of this page:


Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.DataGrid
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Web.Mail
Imports System.Data.SqlTypes
Imports Microsoft.VisualBasic
Imports System.Web.UI.Page
Imports System.Web.Security
Imports System.Web.UI.UserControl
Public Class _default
Inherits System.Web.UI.Page
Dim strLoginUser As String 'class storage of user name
Dim intClientID As Integer 'class storage of client id
Protected WithEvents dgAction As System.Web.UI.WebControls.DataGrid
Protected WithEvents ibDeleteActionItems As System.Web.UI.WebControls.ImageButton
Protected WithEvents ibSelectAllActionItems As System.Web.UI.WebControls.ImageButton
Protected WithEvents rbIssueByID As System.Web.UI.WebControls.RadioButton
Protected WithEvents rbIssueByOriginator As System.Web.UI.WebControls.RadioButton
Protected WithEvents ddlIssueQS As System.Web.UI.WebControls.DropDownList
Protected WithEvents chkIssueQSOpen As System.Web.UI.WebControls.CheckBox
Protected WithEvents chkIssueQSClosed As System.Web.UI.WebControls.CheckBox
Protected WithEvents chkIssueQSOverdue As System.Web.UI.WebControls.CheckBox
Protected WithEvents rbIssues As System.Web.UI.WebControls.RadioButton
Protected WithEvents rbActions As System.Web.UI.WebControls.RadioButton
Protected WithEvents tbl As System.Web.UI.WebControls.Table
Protected WithEvents tblQSCheckboxes As System.Web.UI.WebControls.Table
Protected WithEvents lblBy As System.Web.UI.WebControls.Label
Protected WithEvents btnOk As System.Web.UI.WebControls.Button
Protected WithEvents ibDeselectAllActionItems As System.Web.UI.WebControls.ImageButton
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents open_issues As System.Web.UI.WebControls.DataGrid
Protected WithEvents open_tasks As System.Web.UI.WebControls.DataGrid
Protected WithEvents Welcome As System.Web.UI.WebControls.Label
Protected WithEvents UserID As System.Web.UI.WebControls.Label
Protected WithEvents UserName As System.Web.UI.WebControls.Label
Protected WithEvents CliID As System.Web.UI.WebControls.Label
Protected WithEvents Cli As System.Web.UI.WebControls.Label
Protected WithEvents logout As System.Web.UI.WebControls.Label
Protected WithEvents lbl_opn_iss As System.Web.UI.WebControls.Label
Protected WithEvents tr_opn_iss As System.Web.UI.WebControls.TableRow
Protected WithEvents tbl_ovrdue_iss As System.Web.UI.WebControls.Table
Protected WithEvents tbl_clsd_iss As System.Web.UI.WebControls.Table
Protected WithEvents tbl_clsd_tsk As System.Web.UI.WebControls.Table
Protected WithEvents tbl_ovrdue_tsk As System.Web.UI.WebControls.Table
Protected WithEvents dgActionItems As System.Web.UI.WebControls.Table
Protected WithEvents chkOpenIssues As System.Web.UI.WebControls.CheckBox
Protected WithEvents chkClosedIssues As System.Web.UI.WebControls.CheckBox
Protected WithEvents chkOverdueIssues As System.Web.UI.WebControls.CheckBox
Protected WithEvents chkOpenActions As System.Web.UI.WebControls.CheckBox
Protected WithEvents chkClosedActions As System.Web.UI.WebControls.CheckBox
Protected WithEvents chkOverdueActions As System.Web.UI.WebControls.CheckBox
Protected WithEvents dgIssues As System.Web.UI.WebControls.DataGrid
Protected WithEvents ImageButton3 As System.Web.UI.WebControls.ImageButton
Protected WithEvents ibDeleteIssues As System.Web.UI.WebControls.ImageButton
Protected WithEvents ibSelectAllIssues As System.Web.UI.WebControls.ImageButton
Protected WithEvents ibDeselectAllIssues As System.Web.UI.WebControls.ImageButton

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
'In the code behind of the ASPX file in question
'Dim F As footer
'Dim t As Label
't = F.FindControl("lblFooterName")
't.Text = " Hi "
'or you could call your SetFooter function
'Dim myFooter As footer
'myFooter = FindControl("footer")
'myFooter.lblFooterName.Text = "TEST"

strLoginUser = Session("Login")
intClientID = Session("ClientID")
If Not IsPostBack Then
'bind the grid
'the first time IsPostBack=False (on the initial load)
'because of this we default to open issues
Call SetDefaults()
End If
End Sub
Private Sub SetDefaults()
'default the issues
Me.chkOpenIssues.Checked = True
Me.chkOverdueIssues.Checked = True
BindIssuesGrid(3, 1, strLoginUser)

'default the action items
Me.chkOpenActions.Checked = True
Me.chkOverdueActions.Checked = True
BindActionItemsGrid(3, 1, strLoginUser)
End Sub
Private Sub BindIssuesGrid(ByVal intType As Integer, ByVal intSortField As Integer, ByVal strPerson As String)
Dim cmdSelect As SqlCommand
Dim conMyData As SqlConnection

dgIssues.Visible = False
dgIssues.DataSource = Nothing

'try and make a connection
Try
conMyData = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
cmdSelect = New SqlCommand("select_issues_by_type", conMyData)

With cmdSelect
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@Type", SqlDbType.Int).Value = intType
.Parameters.Add("@Originator", SqlDbType.VarChar).Value = UCase(strPerson)
.Parameters.Add("@ClientID", SqlDbType.Int).Value = intClientID
.Parameters.Add("@SortOrder", SqlDbType.TinyInt).Value = intSortField
conMyData.Open()
dgIssues.DataSource = .ExecuteReader()
End With

dgIssues.DataBind() 'bind the grid
dgIssues.Visible = True
Catch e As Exception
Response.Write("An Error Occurred: " & e.ToString())
'clean up and close resources
Finally
cmdSelect = Nothing
conMyData.Close()
conMyData = Nothing
End Try
End Sub
Private Sub BindActionItemsGridByID(ByVal lngID As Long)
Dim cmdSelect As SqlCommand
Dim conMyData As SqlConnection

dgAction.Visible = False
dgAction.DataSource = Nothing

'try and make a connection
Try
conMyData = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
cmdSelect = New SqlCommand("select_action_item_by_id", conMyData)

With cmdSelect
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@ActionItemID", SqlDbType.Int).Value = lngID
conMyData.Open()
dgAction.DataSource = .ExecuteReader()
End With

dgAction.DataBind() 'bind the grid
dgAction.Visible = True
Catch e As Exception
Response.Write("An Error Occurred: " & e.ToString())
'clean up and close resources
Finally
cmdSelect = Nothing
conMyData.Close()
conMyData = Nothing
End Try
End Sub
Private Sub BindIssuesGridByID(ByVal lngID As Long)
Dim cmdSelect As SqlCommand
Dim conMyData As SqlConnection

dgIssues.Visible = False
dgIssues.DataSource = Nothing

'try and make a connection
Try
conMyData = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
cmdSelect = New SqlCommand("select_issue_by_id", conMyData)

With cmdSelect
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@IssueID", SqlDbType.Int).Value = lngID
conMyData.Open()
dgIssues.DataSource = .ExecuteReader()
End With

dgIssues.DataBind() 'bind the grid
dgIssues.Visible = True
Catch e As Exception
Response.Write("An Error Occurred: " & e.ToString())
'clean up and close resources
Finally
cmdSelect = Nothing
conMyData.Close()
conMyData = Nothing
End Try
End Sub
Private Sub BindActionItemsGrid(ByVal intType As Integer, ByVal intSortField As Integer, ByVal strPerson As String)
Dim cmdSelect As SqlCommand
Dim conMyData As SqlConnection

Me.dgAction.DataSource = Nothing
Me.dgAction.Visible = False
'try and make a connection
Try
conMyData = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
cmdSelect = New SqlCommand("select_action_items_by_type", conMyData)

With cmdSelect
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@Type", SqlDbType.Int).Value = intType
.Parameters.Add("@ResponsiblePerson", SqlDbType.VarChar).Value = LCase(strPerson)
.Parameters.Add("@ClientID", SqlDbType.Int).Value = intClientID
.Parameters.Add("@SortOrder", SqlDbType.TinyInt).Value = intSortField
conMyData.Open()
dgAction.DataSource = .ExecuteReader()
End With

Me.dgAction.DataBind() 'bind the grid
Me.dgAction.Visible = True
Catch e As Exception
Response.Write("An Error Occurred: " & e.ToString())
'clean up and close resources
Finally
cmdSelect = Nothing
conMyData.Close()
conMyData = Nothing
End Try
End Sub
Private Sub ibSelectAllIssues_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibSelectAllIssues.Click
'sub routine to select all issues

Dim objItem As DataGridItem

For Each objItem In Me.dgIssues.Items
'make sure you ignore header / footer
If objItem.ItemType <> ListItemType.Header And _
objItem.ItemType <> ListItemType.Footer And _
objItem.ItemType <> ListItemType.Pager Then
'check it true
CType(objItem.Cells(0).FindControl("chkSelect"), CheckBox).Checked = True
End If
Next
End Sub
Private Sub ibDeselectAllIssues_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibDeselectAllIssues.Click
'sub routine to deselect all issues

Dim objItem As DataGridItem

For Each objItem In Me.dgIssues.Items
'ignore header / footer
If objItem.ItemType <> ListItemType.Header And _
objItem.ItemType <> ListItemType.Footer And _
objItem.ItemType <> ListItemType.Pager Then
'uncheck it (false)
CType(objItem.Cells(0).FindControl("chkSelect"), CheckBox).Checked = False
End If
Next
End Sub
Sub setrowcolor(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onMouseOver", "this.bgColor='#006600'")
e.Item.Attributes.Add("onMouseOut", "this.bgColor='#FFFFFF'")
End If
End Sub
Private Sub dgIssues_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgIssues.ItemDataBound
'the ItemDatabound event triggers for each row of our data grid
'in our procedure we simply change the row's background color based on
'an issues open / closed / target date
'any closed task is given a mint creame color
'any open task is a light light blue color
'any over due task is a light pink color

'make sure you skip the header / footer of the grid
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

'if a space exists means the task is not closed
If e.Item.Cells(6).Text <> " " Then
'task closed
'e.Item.Attributes.Add("onLoad", "this.bgColor='Gainsboro'")
'e.Item.Attributes.Add("onMouseOver", "this.bgColor='Gainsboro'")
'e.Item.Attributes.Add("onMouseOut", "this.bgColor='#FFFFFF'")
e.Item.BackColor = Color.Gainsboro
'handle task open AND overdue
ElseIf CType(e.Item.Cells(5).Text, Date) < Now Then
'task overdue
'e.Item.Attributes.Add("onLoad", "this.bgColor='Linen'")
'e.Item.Attributes.Add("onMouseOver", "this.bgColor='Linen'")
'e.Item.Attributes.Add("onMouseOut", "this.bgColor='#FFFFFF'")
e.Item.BackColor = Color.Linen
Else
'open not overdue
'e.Item.Attributes.Add("onLoad", "this.bgColor='Azure'")
'e.Item.Attributes.Add("onMouseOver", "this.bgColor='Azure'")
'e.Item.Attributes.Add("onMouseOut", "this.bgColor='#FFFFFF'")
e.Item.BackColor = Color.Azure
End If

' 'on mouse overs...currently not working because of the above...
' 'e.Item.Attributes.Add("onMouseOver", "this.bgColor='#006600'")
' 'e.Item.Attributes.Add("onMouseOut", "this.bgColor='#FFFFFF'")
End If
End Sub
Private Sub dgAction_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgAction.ItemDataBound
'the ItemDatabound event triggers for each row of our data grid
'in our procedure we simply change the row's background color based on
'an issues open / closed / target date
'any closed task is given a mint creame color
'any open task is a light light blue color
'any over due task is a light pink color

'make sure you skip the header / footer of the grid
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

'if a space exists means the task is not closed
If e.Item.Cells(5).Text <> " " Then
'task closed
e.Item.BackColor = Color.Gainsboro
'handle task open AND overdue
ElseIf CType(e.Item.Cells(4).Text, Date) < Now Then
'task overdue
e.Item.BackColor = Color.Linen
Else
'open not overdue
e.Item.BackColor = Color.Azure
End If

' 'on mouse overs...currently not working because of the above...
' 'e.Item.Attributes.Add("onMouseOver", "this.bgColor='#006600'")
' 'e.Item.Attributes.Add("onMouseOut", "this.bgColor='#FFFFFF'")
End If
End Sub
Private Sub chkOpenIssues_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkOpenIssues.CheckedChanged
BindIssuesGrid(CheckIssuesSelected(), 1, strLoginUser)
End Sub
Private Function CheckQSSelected() As Integer
'function simply returns an integer
'to eventually get passed in a stored procedure's
'case statement in a where clause
Me.dgAction.Visible = True

If Me.chkIssueQSOpen.Checked = True And Me.chkIssueQSClosed.Checked = True And Me.chkIssueQSOverdue.Checked = True Then
'user wants to see all of them
CheckQSSelected = 1
ElseIf Me.chkIssueQSClosed.Checked = True And Me.chkIssueQSOverdue.Checked = True And Me.chkIssueQSOpen.Checked = False Then
'user wants to see closed and overdue
CheckQSSelected = 2
ElseIf Me.chkIssueQSOpen.Checked = True And Me.chkIssueQSOverdue.Checked = True And Me.chkIssueQSClosed.Checked = False Then
'user wants to see open and overdue
CheckQSSelected = 3
ElseIf Me.chkIssueQSOpen.Checked = True And Me.chkIssueQSClosed.Checked = True And Me.chkIssueQSOverdue.Checked = False Then
'user wants to see open and closed
CheckQSSelected = 4
ElseIf Me.chkIssueQSOverdue.Checked = True Then
'user wants to see only overdue issues
CheckQSSelected = 5
ElseIf Me.chkIssueQSClosed.Checked = True Then
'user wants to see only closed issues
CheckQSSelected = 6
ElseIf Me.chkIssueQSOpen.Checked = True Then
CheckQSSelected = 7
Else
'nothing checked
'set the default (open issues)
Me.dgAction.DataSource = Nothing
Me.dgAction.Visible = False
End If
End Function
Private Function CheckActionItemsSelected() As Integer
'function simply returns an integer
'to eventually get passed in a stored procedure's
'case statement in a where clause
Me.dgAction.Visible = True

If Me.chkOpenActions.Checked = True And Me.chkClosedActions.Checked = True And Me.chkOverdueActions.Checked = True Then
'user wants to see all of them
CheckActionItemsSelected = 1
ElseIf Me.chkClosedActions.Checked = True And Me.chkOverdueActions.Checked = True And Me.chkOpenActions.Checked = False Then
'user wants to see closed and overdue
CheckActionItemsSelected = 2
ElseIf Me.chkOpenActions.Checked = True And Me.chkOverdueActions.Checked = True And Me.chkClosedActions.Checked = False Then
'user wants to see open and overdue
CheckActionItemsSelected = 3
ElseIf Me.chkOpenActions.Checked = True And Me.chkClosedActions.Checked = True And Me.chkOverdueActions.Checked = False Then
'user wants to see open and closed
CheckActionItemsSelected = 4
ElseIf Me.chkOverdueActions.Checked = True Then
'user wants to see only overdue issues
CheckActionItemsSelected = 5
ElseIf Me.chkClosedActions.Checked = True Then
'user wants to see only closed issues
CheckActionItemsSelected = 6
ElseIf Me.chkOpenActions.Checked = True Then
CheckActionItemsSelected = 7
Else
'nothing checked
'set the default (open issues)
Me.dgAction.DataSource = Nothing
Me.dgAction.Visible = False
End If
End Function
Private Function CheckIssuesSelected() As Integer
'function simply returns an integer
'to eventually get passed in a stored procedure's
'case statement in a where clause
Me.dgIssues.Visible = True

If Me.chkOpenIssues.Checked = True And Me.chkClosedIssues.Checked = True And Me.chkOverdueIssues.Checked = True Then
'user wants to see all of them
CheckIssuesSelected = 1
ElseIf Me.chkClosedIssues.Checked = True And Me.chkOverdueIssues.Checked = True And Me.chkOpenIssues.Checked = False Then
'user wants to see closed and overdue
CheckIssuesSelected = 2
ElseIf Me.chkOpenIssues.Checked = True And Me.chkOverdueIssues.Checked = True And Me.chkClosedIssues.Checked = False Then
'user wants to see open and overdue
CheckIssuesSelected = 3
ElseIf Me.chkOpenIssues.Checked = True And Me.chkClosedIssues.Checked = True And Me.chkOverdueIssues.Checked = False Then
'user wants to see open and closed
CheckIssuesSelected = 4
ElseIf Me.chkOverdueIssues.Checked = True Then
'user wants to see only overdue issues
CheckIssuesSelected = 5
ElseIf Me.chkClosedIssues.Checked = True Then
'user wants to see only closed issues
CheckIssuesSelected = 6
ElseIf Me.chkOpenIssues.Checked = True Then
CheckIssuesSelected = 7
Else
'nothing checked
'set the default (open issues)
Me.dgIssues.DataSource = Nothing
Me.dgIssues.Visible = False
'Me.chkOpenIssues.Checked = True
'Me.chkOverdueIssues.Checked = True
'CheckIssuesSelected = 3
End If
End Function
Private Sub chkClosedIssues_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkClosedIssues.CheckedChanged
BindIssuesGrid(CheckIssuesSelected(), 1, strLoginUser)
End Sub
Private Sub chkOverdueIssues_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkOverdueIssues.CheckedChanged
BindIssuesGrid(CheckIssuesSelected(), 1, strLoginUser)
End Sub
Public Sub dgIssues_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dgIssues.SortCommand
BindIssuesGrid(CheckIssuesSelected(), e.SortExpression, strLoginUser)
End Sub
Private Sub ibSelectAllActionItems_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibSelectAllActionItems.Click
'sub routine to select all issues

Dim objItem As DataGridItem

For Each objItem In Me.dgAction.Items
'make sure you ignore header / footer
If objItem.ItemType <> ListItemType.Header And _
objItem.ItemType <> ListItemType.Footer And _
objItem.ItemType <> ListItemType.Pager Then
'check it true
CType(objItem.Cells(0).FindControl("chkAISelect"), CheckBox).Checked = True
End If
Next
End Sub
Private Sub ibDeselectAllActionItems_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibDeselectAllActionItems.Click
'sub routine to deselect all issues

Dim objItem As DataGridItem

For Each objItem In Me.dgAction.Items
'ignore header / footer
If objItem.ItemType <> ListItemType.Header And _
objItem.ItemType <> ListItemType.Footer And _
objItem.ItemType <> ListItemType.Pager Then
'uncheck it (false)
CType(objItem.Cells(0).FindControl("chkAISelect"), CheckBox).Checked = False
End If
Next
End Sub
Private Sub chkOpenActions_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkOpenActions.CheckedChanged
BindActionItemsGrid(CheckActionItemsSelected(), 1, strLoginUser)
End Sub
Private Sub chkClosedActions_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkClosedActions.CheckedChanged
BindActionItemsGrid(CheckActionItemsSelected(), 1, strLoginUser)
End Sub
Private Sub chkOverdueActions_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkOverdueActions.CheckedChanged
BindActionItemsGrid(CheckActionItemsSelected(), 1, strLoginUser)
End Sub
Private Sub ibDeleteIssues_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibDeleteIssues.Click
'sub routine to delete issues
'using SQL DELETE IN keywords
'this ensures only ONE pass for a MASS delete
'this is a lot more efficient then calling DELETE multiple
'times on an SQLCommand object.

Dim objItem As DataGridItem
Dim strSQL As String
Dim bGoodDelete As Boolean
Dim blnDelete As Boolean

'assume not a good delete
bGoodDelete = False
'generate beginning of Select Query Language (SQL)
strSQL = "DELETE Issue WHERE IssueID IN("

'loop through all the items of a grid
For Each objItem In dgIssues.Items
'skip the headers
If objItem.ItemType <> ListItemType.Header And _
objItem.ItemType <> ListItemType.Footer And _
objItem.ItemType <> ListItemType.Pager Then
'store whether or not user wants to delete the issue
blnDelete = CType(objItem.Cells(0).FindControl("chkSelect"), CheckBox).Checked
If blnDelete = True Then
'good delete
'add the ID number to the SQL DELETE IN CLAUSE
bGoodDelete = True
strSQL = strSQL & Me.dgIssues.DataKeys(objItem.ItemIndex) & ","
End If
End If
Next

'was the delete any good
If bGoodDelete = True Then
'it was so get rid of the last ',' in the SQL DELETE statement
strSQL = Left(strSQL, Len(strSQL) - 1)
'tack on the closing parenthesis
strSQL = strSQL & ")"
'perform the deletion
MassDelete(strSQL)
'rebind the data grid
BindIssuesGrid(CheckIssuesSelected(), 1, strLoginUser)
Else
'no deletions needed
End If

End Sub
Private Sub MassDelete(ByVal strSQL As String)
Dim conMyData As SqlConnection
Dim cmdDelete As SqlCommand

'try and make a connection
Try
conMyData = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
'strSQL contains a DELETE IN sql clause
cmdDelete = New SqlCommand(strSQL, conMyData)
conMyData.Open()
cmdDelete.ExecuteNonQuery()
'catch any exceptions that might be thrown
Catch e As Exception
Response.Write("An Error Occurred: " & e.ToString())
'clean up and close resources
Finally
cmdDelete = Nothing
conMyData.Close()
conMyData = Nothing
End Try

End Sub
Private Sub ibDeleteActionItems_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibDeleteActionItems.Click
'sub routine to delete action items
'uses a DELETE IN sql clause
'makes one single passthrough and is more efficient
'then recalling a DELETE statement of the SQL command type
Dim objItem As DataGridItem
Dim strSQL As String
Dim bGoodDelete As Boolean
Dim blnDelete As Boolean

'assume nothing gets deleted
bGoodDelete = False
'generate initial delete statement
strSQL = "DELETE ActionItem WHERE ActionItemID IN("

'loop through rows
For Each objItem In dgAction.Items
If objItem.ItemType <> ListItemType.Header And _
objItem.ItemType <> ListItemType.Footer And _
objItem.ItemType <> ListItemType.Pager Then
'grab the status of whether it should be deleted or not
blnDelete = CType(objItem.Cells(0).FindControl("chkAISelect"), CheckBox).Checked
If blnDelete = True Then
'yes delete it
bGoodDelete = True
strSQL = strSQL & Me.dgAction.DataKeys(objItem.ItemIndex) & ","
End If
End If
Next

'do we need to delete?
If bGoodDelete = True Then
'yes
'get rid of last ','
strSQL = Left(strSQL, Len(strSQL) - 1)
'tack on ')'
strSQL = strSQL & ")"
'perform the deletion
MassDelete(strSQL)
'rebind the action items
BindActionItemsGrid(CheckActionItemsSelected(), 1, strLoginUser)
Else
'no deletions needed
End If
End Sub

Private Sub rbIssueByOriginator_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbIssueByOriginator.CheckedChanged
If Me.rbIssueByOriginator.Checked = True Then
Me.tblQSCheckboxes.Visible = True
Me.ddlIssueQS.Visible = True
Me.btnOk.Visible = True

'check if issues was selected
If Me.rbIssues.Checked = True Then
'issues wanted now check selection by
If Me.rbIssueByID.Checked = True Then
FillQSCombo(intClientID, "select_qs_issue_ids_by_client_id", "IssueID", "IssueID")
Else
FillQSCombo(intClientID, "select_qs_issue_originators_by_client_id", "Originator", "Originator")
End If
Else
'action items wanted
If Me.rbIssueByID.Checked = True Then
FillQSCombo(intClientID, "select_qs_action_item_ids_by_client_id", "ActionItemID", "ActionItemID")
Else
FillQSCombo(intClientID, "select_qs_action_item_originators_by_client_id", "ResponsiblePerson", "ResponsiblePerson")
End If
End If
Else
Me.tblQSCheckboxes.Visible = False
Me.ddlIssueQS.Visible = False
Me.btnOk.Visible = False
End If
End Sub

Private Sub rbIssueByID_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbIssueByID.CheckedChanged
If Me.rbIssueByID.Checked = True Then
Me.tblQSCheckboxes.Visible = False
Me.ddlIssueQS.Visible = True
Me.btnOk.Visible = True

'check if issues was selected
If Me.rbIssues.Checked = True Then
'issues wanted now check selection by
If Me.rbIssueByID.Checked = True Then
FillQSCombo(intClientID, "select_qs_issue_ids_by_client_id", "IssueID", "IssueID")
Else
FillQSCombo(intClientID, "select_qs_issue_originators_by_client_id", "Originator", "Originator")
End If
Else
'action items wanted
If Me.rbIssueByID.Checked = True Then
FillQSCombo(intClientID, "select_qs_action_item_ids_by_client_id", "ActionItemID", "ActionItemID")
Else
FillQSCombo(intClientID, "select_qs_action_item_originators_by_client_id", "ResponsiblePerson", "ResponsiblePerson")
End If
End If
Else
Me.tblQSCheckboxes.Visible = True
Me.ddlIssueQS.Visible = False
Me.btnOk.Visible = False
End If

End Sub
Private Sub FillQSCombo(ByVal intCID As Integer, ByVal strSprocName As String, ByVal strTextField As String, ByVal strValueField As String)
Dim conMyData As SqlConnection
Dim cmdSelect As SqlCommand
Dim reader As SqlDataReader

Me.ddlIssueQS.ClearSelection()
Me.ddlIssueQS.DataSource = Nothing

'try and make a connection
Try
'conn string
conMyData = New SqlConnection(ConfigurationSettings.AppSettings("strConn"))
'use a stored procedure to snatch the clients
cmdSelect = New SqlCommand(strSprocName, conMyData)
'set the type
cmdSelect.CommandType = CommandType.StoredProcedure
cmdSelect.Parameters.Add("@ClientID", intClientID)
'open the connection
conMyData.Open()
'run the query
reader = cmdSelect.ExecuteReader()

With ddlIssueQS
.DataSource = reader
.DataTextField = strTextField
.DataValueField = strValueField
.DataBind()
End With

'catch any exceptions that might be thrown
Catch e As Exception
Response.Write("An Error Occurred: " & e.ToString())
'clean up and close resources
Finally
cmdSelect = Nothing
reader.Close()
conMyData.Close()
conMyData = Nothing
End Try

End Sub

Private Sub rbIssues_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbIssues.CheckedChanged
Me.tblQSCheckboxes.Visible = False
Me.btnOk.Visible = False
Me.ddlIssueQS.Visible = False
Me.rbIssueByID.Checked = False
Me.rbIssueByOriginator.Checked = False
Me.rbIssueByID.Visible = False
Me.rbIssueByOriginator.Visible = False
Me.lblBy.Visible = False

If rbIssues.Checked = True Then
rbIssueByID.Visible = True
rbIssueByOriginator.Visible = True
Me.lblBy.Visible = True
Else
rbIssueByID.Visible = False
rbIssueByOriginator.Visible = False
Me.lblBy.Visible = False
End If
End Sub

Private Sub rbActions_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbActions.CheckedChanged
Me.tblQSCheckboxes.Visible = False
Me.btnOk.Visible = False
Me.ddlIssueQS.Visible = False
Me.rbIssueByID.Checked = False
Me.rbIssueByOriginator.Checked = False
Me.rbIssueByID.Visible = False
Me.rbIssueByOriginator.Visible = False
Me.lblBy.Visible = False

If rbActions.Checked = True Then
rbIssueByID.Visible = True
rbIssueByOriginator.Visible = True
Me.lblBy.Visible = True
Else
rbIssueByID.Visible = False
rbIssueByOriginator.Visible = False
Me.lblBy.Visible = False
End If
End Sub
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
If Me.rbIssues.Checked = True Then
'looking for issues
If Me.rbIssueByID.Checked = True Then
'looking for issues
'based on IssueID
BindIssuesGridByID(Me.ddlIssueQS.SelectedValue)
Else
'based on Originator
BindIssuesGrid(CheckQSSelected(), 1, Me.ddlIssueQS.SelectedValue)
End If
CheckMyIssues(False)
Else
'looking for action items
If Me.rbIssueByID.Checked = True Then
'looking for action items
'based on ActionItemID
BindActionItemsGridByID(Me.ddlIssueQS.SelectedValue)
Else
'looking for action items
'based on person
BindActionItemsGrid(CheckQSSelected(), 1, Me.ddlIssueQS.SelectedValue)
End If
CheckMyActionItems(False)
End If
End Sub
Private Sub CheckMyIssues(ByVal bVal As Boolean)
Me.chkOpenIssues.Checked = bVal
Me.chkClosedIssues.Checked = bVal
Me.chkOverdueIssues.Checked = bVal
End Sub
Private Sub CheckMyActionItems(ByVal bVal As Boolean)
Me.chkOpenActions.Checked = bVal
Me.chkClosedActions.Checked = bVal
Me.chkOverdueActions.Checked = bVal
End Sub
End Class
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 14:54:59
Where's the other part of the ASPX page?
I don't see the user control declared in the top of this code behind, and that might be part of the problem here.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 14:56:34
Im guessing you want the html side:


<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb" Inherits="ims.jakah.com._default" %>
<%@ Register TagPrefix="uc1" TagName="header" Src="includes/header.ascx" %>
<%@ Register TagPrefix="uc2" TagName="footer" Src="includes/footer.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>IMS</TITLE>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<SCRIPT language="javascript" src="includes/js/scripts.js"></SCRIPT>
<LINK href="includes/ims.css" type="text/css" rel="stylesheet">
</HEAD>
<BODY>
<form id="Form1" method="post" runat="server">
<uc1:header id="Header1" runat="server"></uc1:header>
<table id="Table2" cellPadding="0" width="100%" border="0">
<tr>
<td vAlign="top" width="15%">
<table id="Table1" cellPadding="0" width="100%" border="0">
<tr>
<td class="sd_header" colSpan="3">My Issues</td>
</tr>
<tr class="sidebar">
<td colSpan="2"><asp:checkbox id="chkOpenIssues" runat="server" BackColor="Azure" Width="200px" Text="Open" AutoPostBack="True"></asp:checkbox></td>
<td></td>
</tr>
<tr class="sidebar">
<td><asp:checkbox id="chkClosedIssues" runat="server" BackColor="Gainsboro" Width="200px" Text="Closed"
AutoPostBack="True"></asp:checkbox></td>
<td></td>
</tr>
<tr class="sidebar">
<td><asp:checkbox id="chkOverdueIssues" runat="server" BackColor="Linen" Width="200px" Text="Overdue"
AutoPostBack="True"></asp:checkbox></FONT></td>
<td></td>
</tr>
<tr class="sidebar">
<td><FONT face="Arial"> </FONT></td>
</tr>
<tr class="sidebar">
<td class="sd_header" colSpan="3"><FONT face="Arial">My Action Items</FONT></td>
</tr>
<tr class="sidebar">
<td><asp:checkbox id="chkOpenActions" runat="server" BackColor="Azure" Width="200px" Text="Open" AutoPostBack="True"></asp:checkbox></FONT></td>
<td></td>
</tr>
<tr class="sidebar">
<td><asp:checkbox id="chkClosedActions" runat="server" BackColor="Gainsboro" Width="200px" Text="Closed"
AutoPostBack="True"></asp:checkbox></FONT></td>
<td></td>
</tr>
<tr class="sidebar">
<td><asp:checkbox id="chkOverdueActions" runat="server" BackColor="Linen" Width="200px" Text="Overdue"
AutoPostBack="True"></asp:checkbox></FONT></td>
<td></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="sd_header" colSpan="3"><FONT face="Arial">Saved Reports</FONT></td>
</tr>
<tr class="sidebar">
<td colSpan="2"><i>No Saved Reports</i></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="sd_header" colSpan="3">Quick Search</td>
</tr>
<TR>
<TD colSpan="2"><FONT face="Arial" size="2">
<P align="left">Type:
<asp:radiobutton id="rbIssues" runat="server" Text="Issues" AutoPostBack="True" Font-Names="Arial"
GroupName="rbQSType"></asp:radiobutton><asp:radiobutton id="rbActions" runat="server" Width="72px" Text="Actions" AutoPostBack="True" Font-Names="Arial"
GroupName="rbQSType"></asp:radiobutton></P>
</FONT>
</TD>
</TR>
<TR>
<TD style="HEIGHT: 18px" colSpan="2"><FONT face="Arial" size="2">
<P align="left"> 
<asp:label id="lblBy" runat="server" Width="24px" Font-Names="Arial" Visible="False">By: </asp:label> <asp:radiobutton id="rbIssueByID" runat="server" Width="40px" Text="ID" AutoPostBack="True" GroupName="rbQuickSearch"
Visible="False"></asp:radiobutton>    <asp:radiobutton id="rbIssueByOriginator" runat="server" Width="72px" Text="Person" AutoPostBack="True"
GroupName="rbQuickSearch" Visible="False"></asp:radiobutton></P>
</FONT>
</TD>
</TR>
<TR>
<td><asp:table id="tblQSCheckboxes" Visible="False" Runat="server">
<asp:TableRow>
<asp:TableCell>
<asp:checkbox id="chkIssueQSOpen" runat="server" BackColor="White" Text="Open" Font-Names="Arial"
Font-Size="X-Small" Enabled="True"></asp:checkbox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:checkbox id="chkIssueQSClosed" runat="server" BackColor="White" Text="Closed" Font-Names="Arial"
Font-Size="X-Small" Enabled="True"></asp:checkbox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:checkbox id="chkIssueQSOverdue" runat="server" BackColor="White" Text="Overdue" Font-Names="Arial"
Font-Size="X-Small" Enabled="True"></asp:checkbox>
</asp:TableCell>
</asp:TableRow>
</asp:table></td>
</TR>
<tr class="sidebar">
<td colSpan="2"> 
<asp:dropdownlist id="ddlIssueQS" Width="112px" Visible="False" Runat="server"></asp:dropdownlist><asp:button id="btnOk" runat="server" Text="Ok" Visible="False"></asp:button><br>
</td>
</tr>
</table>
</td>
<TD class="dgissues" vAlign="top">
<table width="100%">
<tr>
<td align="center" width="1%"><asp:imagebutton id="ibDeleteIssues" runat="server" Tooltip="Delete Issue(s)" ImageUrl="/images/delete.gif"></asp:imagebutton></td>
<td align="center" width="1%"><asp:imagebutton id="ibSelectAllIssues" runat="server" Tooltip="Select All Issues" ImageUrl="/images/selectall.gif"></asp:imagebutton></td>
<td align="center" width="1%"><asp:imagebutton id="ibDeselectAllIssues" runat="server" Tooltip="Deselect All Issues" ImageUrl="/images/deselectall.gif"></asp:imagebutton></td>
<td class="sd_header">Issues</td>
</tr>
<tr>
<td colSpan="4"><asp:datagrid id="dgIssues" runat="server" Width="100%" Font-Names="Arial" OnSortCommand="dgIssues_SortCommand"
DataKeyField="IssueID" AutoGenerateColumns="False" AllowSorting="True">
<Columns>
<asp:TemplateColumn ItemStyle-Width="3%" headerstyle-cssclass="RowType_DK">
<ItemTemplate>
<asp:CheckBox id="chkSelect" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:HyperLinkColumn DataNavigateUrlField="IssueID" DataNavigateUrlFormatString="Details.aspx?IssueID={0}"
DataTextField="IssueID" HeaderText="ID" ItemStyle-Width="3%" SortExpression="1" headerstyle-cssclass="RowType_DK"></asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="IssueID" DataNavigateUrlFormatString="Details.aspx?IssueID={0}"
HeaderText="Comm." ItemStyle-Width="10%" DatatextField="Commission" headerstyle-cssclass="RowType_DK"
SortExpression="2">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="IssueID" DataNavigateUrlFormatString="Details.aspx?IssueID={0}"
HeaderText="C.U" ItemStyle-Width="6%" DatatextField="CostUnit" headerstyle-cssclass="RowType_DK"
SortExpression="3">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="IssueID" DataNavigateUrlFormatString="Details.aspx?IssueID={0}"
HeaderText="Open" ItemStyle-Width="8%" datatextformatstring="{0:dd-MMM-yyyy}" DatatextField="OpenDate"
headerstyle-cssclass="RowType_DK" SortExpression="4">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="IssueID" DataNavigateUrlFormatString="Details.aspx?IssueID={0}"
HeaderText="Target" ItemStyle-Width="8%" datatextformatstring="{0:dd-MMM-yyyy}" DatatextField="TargetDate"
headerstyle-cssclass="RowType_DK" SortExpression="5">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="IssueID" DataNavigateUrlFormatString="Details.aspx?IssueID={0}"
HeaderText="Closed" ItemStyle-Width="8%" datatextformatstring="{0:dd-MMM-yyyy}" DatatextField="ClosedDate"
headerstyle-cssclass="RowType_DK" SortExpression="6">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="IssueID" DataNavigateUrlFormatString="Details.aspx?IssueID={0}"
HeaderText="Issue" DatatextField="Issue" headerstyle-cssclass="RowType_DK" SortExpression="7">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
</Columns>
</asp:datagrid></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center" width="1%"><asp:imagebutton id="ibDeleteActionItems" runat="server" Tooltip="Delete Action Item(s)" ImageUrl="/images/delete.gif"></asp:imagebutton></td>
<td align="center" width="1%"><asp:imagebutton id="ibSelectAllActionItems" runat="server" Tooltip="Select All Action Items" ImageUrl="/images/selectall.gif"></asp:imagebutton></td>
<td align="center" width="1%"><asp:imagebutton id="ibDeselectAllActionItems" runat="server" Tooltip="Deselect All Action Items"
ImageUrl="/images/deselectall.gif"></asp:imagebutton></td>
<td class="sd_header">Action Items</td>
</tr>
<tr>
<td colSpan="4"><asp:datagrid id="dgAction" runat="server" Font-Names="Arial" cssclass="dgissues" DataKeyField="ActionItemID"
AutoGenerateColumns="False" AllowSorting="True" width="100%">
<Columns>
<asp:TemplateColumn ItemStyle-Width="3%" headerstyle-cssclass="RowType_DK">
<ItemTemplate>
<asp:CheckBox id="chkAISelect" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:HyperLinkColumn DataNavigateUrlField="ActionItemID" DataNavigateUrlFormatString="AIDetails.aspx?ActionItemID={0}"
DataTextField="ActionItemID" HeaderText="ID" ItemStyle-Width="3%" headerstyle-cssclass="RowType_DK"
SortExpression="1"></asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="ActionItemID" DataNavigateUrlFormatString="AIDetails.aspx?ActionItemID={0}"
HeaderText="Priority" ItemStyle-Width="8%" headerstyle-cssclass="RowType_DK" DatatextField="PriorityID"
SortExpression="2">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="ActionItemID" DataNavigateUrlFormatString="AIDetails.aspx?ActionItemID={0}"
HeaderText="Open" ItemStyle-Width="8%" headerstyle-cssclass="RowType_DK" datatextformatstring="{0:dd-MMM-yyyy}"
DatatextField="OpenDate" SortExpression="3">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="ActionItemID" DataNavigateUrlFormatString="AIDetails.aspx?ActionItemID={0}"
HeaderText="Target" ItemStyle-Width="8%" headerstyle-cssclass="RowType_DK" datatextformatstring="{0:dd-MMM-yyyy}"
DatatextField="TargetDate" SortExpression="4">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="ActionItemID" DataNavigateUrlFormatString="AIDetails.aspx?ActionItemID={0}"
HeaderText="Closed" ItemStyle-Width="8%" headerstyle-cssclass="RowType_DK" datatextformatstring="{0:dd-MMM-yyyy}"
DatatextField="ClosedDate" SortExpression="5">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="ActionItemID" DataNavigateUrlFormatString="AIDetails.aspx?ActionItemID={0}"
HeaderText="Issue" headerstyle-cssclass="RowType_DK" DatatextField="Issue" SortExpression="6">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
<asp:HyperLinkColumn DataNavigateUrlField="ActionItemID" DataNavigateUrlFormatString="AIDetails.aspx?ActionItemID={0}"
HeaderText="Action Item" headerstyle-cssclass="RowType_DK" DatatextField="ActionItem" SortExpression="7">
<ItemStyle Wrap="False"></ItemStyle>
</asp:HyperLinkColumn>
</Columns>
</asp:datagrid></td>
</tr>
</table>
<uc2:footer id="footer" runat="server"></uc2:footer></TD>
</tr>
</table>
</form>
<P> </P>
<P> </P>
<P> </P>
</BODY>
</HTML>


The footer is at the bottom!
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 15:42:37
Hmm Ok, I'm getting a better understanding as to how this thing is setup. I've never used user controls with the the "Register TagPrefix" code.

The FindControl thing should still work though.
Given your variable names, it should be like this:


Dim myFooter as usercontrol
myFooter = FindControl("footer")

myFooter.lblFooter.text = "Admin"



Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 15:46:38
I dont see how lblFooter fits in ?
If I say myFooter.lblANYTHING
no label shows up...

lblFooterName is a public variable (public label in footer.ascx).

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 15:48:49
Ok, then try the following. I mistyped the labelname.
myFooter.lblFooterName.text = "Admin"


<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
    Next Page

- Advertisement -