B
Brock
First note that I am using Framework 1.1. I have an .aspx page that is
displaying a list of employees, but only the Employee Number, First
Name, Last Name, and Title. It is working great. I recessed it in a
<Div></Div> to allow scrolling of just the data, not the page. What I
need to do is place a DataList (also in a <Div></Div> to allow
scrolling of just the data) to the right of the Datagrid to show 40
Employee Detail fields (listed top to bottom). Ideally I'd like to
have a "Select" in the first column to allow the user to click on that
employee and see the scrollable details listed for that employee in
the DataList to the right of the DataGrid. Below is my html and below
that is my code-behind. What I need help with is getting a "Select"
column in and causing upon pressing that the rest of the 40 fileds to
display... Thanks for any clues! (also how can I get
both the DG and the DL to be placed side-by-side? I can't seem to move
these around in the designer.)
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="MainDepartment.aspx.vb"
Inherits="Forsyth.HR_ReportingTool.UI.MainDepartment" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>MainDepartment</title>
<META http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta content="False" name="vs_snapToGrid">
<meta content="False" name="vs_showGrid">
<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">
</HEAD>
<BODY background="file:///C:\Inetpub\wwwroot\HR_ReportingTool
\vignette.gif">
<div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE:
medium; BORDER-LEFT-COLOR: white; FLOAT: none; BORDER-BOTTOM-COLOR:
white; MARGIN-LEFT: 20px; OVERFLOW: auto; WIDTH: 701px; CLIP:
rect(auto auto auto auto); COLOR: black; BORDER-TOP-STYLE: inset;
BORDER-TOP-COLOR: white; TEXT-INDENT: 5%; FONT-FAMILY: 'Times New
Roman'; BORDER-RIGHT-STYLE: inset; BORDER-LEFT-STYLE: inset; HEIGHT:
599px; BACKGROUND-COLOR: white; TEXT-ALIGN: left; BORDER-RIGHT-COLOR:
white; BORDER-BOTTOM-STYLE: inset"
align="left">
<DIV>
<FORM id="Form1" method="post" runat="server">
<asp:datagrid id="dgEmployees" Width="640px" BorderStyle="Solid"
runat="server" Height="136px"
HorizontalAlign="Center" AllowSorting="True"
BorderColor="Silver" Font-Size="X-Small">
<SelectedItemStyle Font-Underline="True" Font-Bold="True"></
SelectedItemStyle>
<AlternatingItemStyle BackColor="#C0FFC0"></
AlternatingItemStyle>
</asp:datagrid></FORM>
</DIV>
</div>
</BODY>
</HTML>
_______________________________________________________________________________________________________
Public Class MainDepartment
Inherits System.Web.UI.Page
Private m_department As String
Private m_title As String
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
'lblWelcome.Text = "Hello " & Global.UserSecurity.Fname.Trim &
" " & Global.UserSecurity.Lname
Dim act As Action
Dim pos As Position
Dim empname As String
Dim lvi As ListItem
Dim Employee As Employee
Dim empcount As Integer
act = (New
ActionBroker).GetActionCurrent(Global.UserSecurity.EmpId, Today,
Global.UserName, Global.UserPassword, Global.appDataSource)
pos = (New PositionBroker).GetPosition(act.PositionID,
Global.UserName, Global.UserPassword, Global.appDataSource)
m_department = pos.Department.Name
Dim emps As Employees = (New
EmployeeBroker).GetCurrentEmployeesByDepartment(m_department,
Global.UserName, Global.UserPassword, Global.appDataSource)
Dim dt As New DataTable
Dim count As Integer = 0
For Each emp As Employee In emps
SetListViewItem(emp, dt, count)
count = count + 1
Next
dgEmployees.DataSource = dt
dgEmployees.DataBind()
End Sub
Private Sub SetListViewItem(ByVal dr As Employee, ByVal dt As
DataTable, ByVal count As Integer)
If count = 0 Then
dt.Columns.Add("Emp #")
dt.Columns.Add("Last Name")
dt.Columns.Add("First Name")
dt.Columns.Add("Title")
End If
Dim EmpPos As Action = (New
ActionBroker).GetActionCurrent(dr.Key, Today, Global.UserName,
Global.UserPassword, Global.appDataSource)
Dim employee As DataRow = dt.NewRow
employee("Emp #") = dr.Key
employee("Last Name") = dr.LastName
employee("First Name") = dr.FirstName
employee("Title") = EmpPos.WorkAgainstInfo.Title
dt.Rows.Add(employee)
End Sub 'SetListViewItem
Private Function FindEmp(ByVal EmployeeID As Integer) As String
Dim emp As Employee
Dim retval As String
Try
If EmployeeID > 0 Then
emp = (New EmployeeBroker).GetEmployee(EmployeeID,
Global.UserName, Global.UserPassword, Global.appDataSource)
retval = String.Empty
If Not IsNothing(emp) Then
retval = emp.FirstName & " " & emp.MI & " " &
emp.LastName
Else
retval = "Vacant"
End If
Else
retval = ""
End If
Catch ex As Exception
Global.HandleException(ex)
retval = String.Empty
End Try
Return retval
End Function
End Class
displaying a list of employees, but only the Employee Number, First
Name, Last Name, and Title. It is working great. I recessed it in a
<Div></Div> to allow scrolling of just the data, not the page. What I
need to do is place a DataList (also in a <Div></Div> to allow
scrolling of just the data) to the right of the Datagrid to show 40
Employee Detail fields (listed top to bottom). Ideally I'd like to
have a "Select" in the first column to allow the user to click on that
employee and see the scrollable details listed for that employee in
the DataList to the right of the DataGrid. Below is my html and below
that is my code-behind. What I need help with is getting a "Select"
column in and causing upon pressing that the rest of the 40 fileds to
display... Thanks for any clues! (also how can I get
both the DG and the DL to be placed side-by-side? I can't seem to move
these around in the designer.)
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="MainDepartment.aspx.vb"
Inherits="Forsyth.HR_ReportingTool.UI.MainDepartment" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>MainDepartment</title>
<META http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta content="False" name="vs_snapToGrid">
<meta content="False" name="vs_showGrid">
<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">
</HEAD>
<BODY background="file:///C:\Inetpub\wwwroot\HR_ReportingTool
\vignette.gif">
<div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE:
medium; BORDER-LEFT-COLOR: white; FLOAT: none; BORDER-BOTTOM-COLOR:
white; MARGIN-LEFT: 20px; OVERFLOW: auto; WIDTH: 701px; CLIP:
rect(auto auto auto auto); COLOR: black; BORDER-TOP-STYLE: inset;
BORDER-TOP-COLOR: white; TEXT-INDENT: 5%; FONT-FAMILY: 'Times New
Roman'; BORDER-RIGHT-STYLE: inset; BORDER-LEFT-STYLE: inset; HEIGHT:
599px; BACKGROUND-COLOR: white; TEXT-ALIGN: left; BORDER-RIGHT-COLOR:
white; BORDER-BOTTOM-STYLE: inset"
align="left">
<DIV>
<FORM id="Form1" method="post" runat="server">
<asp:datagrid id="dgEmployees" Width="640px" BorderStyle="Solid"
runat="server" Height="136px"
HorizontalAlign="Center" AllowSorting="True"
BorderColor="Silver" Font-Size="X-Small">
<SelectedItemStyle Font-Underline="True" Font-Bold="True"></
SelectedItemStyle>
<AlternatingItemStyle BackColor="#C0FFC0"></
AlternatingItemStyle>
</asp:datagrid></FORM>
</DIV>
</div>
</BODY>
</HTML>
_______________________________________________________________________________________________________
Public Class MainDepartment
Inherits System.Web.UI.Page
Private m_department As String
Private m_title As String
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
'lblWelcome.Text = "Hello " & Global.UserSecurity.Fname.Trim &
" " & Global.UserSecurity.Lname
Dim act As Action
Dim pos As Position
Dim empname As String
Dim lvi As ListItem
Dim Employee As Employee
Dim empcount As Integer
act = (New
ActionBroker).GetActionCurrent(Global.UserSecurity.EmpId, Today,
Global.UserName, Global.UserPassword, Global.appDataSource)
pos = (New PositionBroker).GetPosition(act.PositionID,
Global.UserName, Global.UserPassword, Global.appDataSource)
m_department = pos.Department.Name
Dim emps As Employees = (New
EmployeeBroker).GetCurrentEmployeesByDepartment(m_department,
Global.UserName, Global.UserPassword, Global.appDataSource)
Dim dt As New DataTable
Dim count As Integer = 0
For Each emp As Employee In emps
SetListViewItem(emp, dt, count)
count = count + 1
Next
dgEmployees.DataSource = dt
dgEmployees.DataBind()
End Sub
Private Sub SetListViewItem(ByVal dr As Employee, ByVal dt As
DataTable, ByVal count As Integer)
If count = 0 Then
dt.Columns.Add("Emp #")
dt.Columns.Add("Last Name")
dt.Columns.Add("First Name")
dt.Columns.Add("Title")
End If
Dim EmpPos As Action = (New
ActionBroker).GetActionCurrent(dr.Key, Today, Global.UserName,
Global.UserPassword, Global.appDataSource)
Dim employee As DataRow = dt.NewRow
employee("Emp #") = dr.Key
employee("Last Name") = dr.LastName
employee("First Name") = dr.FirstName
employee("Title") = EmpPos.WorkAgainstInfo.Title
dt.Rows.Add(employee)
End Sub 'SetListViewItem
Private Function FindEmp(ByVal EmployeeID As Integer) As String
Dim emp As Employee
Dim retval As String
Try
If EmployeeID > 0 Then
emp = (New EmployeeBroker).GetEmployee(EmployeeID,
Global.UserName, Global.UserPassword, Global.appDataSource)
retval = String.Empty
If Not IsNothing(emp) Then
retval = emp.FirstName & " " & emp.MI & " " &
emp.LastName
Else
retval = "Vacant"
End If
Else
retval = ""
End If
Catch ex As Exception
Global.HandleException(ex)
retval = String.Empty
End Try
Return retval
End Function
End Class