Thanks in advance... (you can see a screenshot of what my form looks
like currently at http://www.juggernautical.com/DataGrid.jpg - the
Datalist is super-imposed in 'design view' but the DataGrid is the
actual running of the page) I've almost got this working (?) but need
a little help. I have an .aspx page that has a DataGrid listing
employees with a "Select" button that is to be used to populate the
DataList to the right of the DataGrid with additional employee
information. I'm basing this off the model found at
http://www.aspnet101.com/aspnet101/a...px?code=choose
.. this is a very good example of what I'm trying to do. I can populate
the DataGrid with no problem, but the "Select" button will not
populate the DataList. BTW, I'm using framework 1.1 and Code behind
(all listed below), in addition I'm using Broker DLL's to get my data.
Any clues?
<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Mai nDepartment.asp x.vb"
Inherits="Forsy th.HR_Reporting Tool.UI.MainDep artment" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>MainDepa rtment</title>
<META http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta content="False" name="vs_snapTo Grid">
<meta content="False" name="vs_showGr id">
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<BODY background="fil e:///C:\Inetpub\wwwr oot\HR_Reportin gTool
\vignette.gif">
<div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE:
medium; BORDER-LEFT-COLOR: white; LEFT: 50px; FLOAT: none; BORDER-
BOTTOM-COLOR: white; MARGIN-LEFT: 20px; OVERFLOW: auto; WIDTH: 734px;
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;
POSITION: absolute; TOP: 50px; HEIGHT: 599px; BACKGROUND-COLOR: white;
TEXT-ALIGN: left; BORDER-RIGHT-COLOR: white; BORDER-BOTTOM-STYLE:
inset"
align="left">
<DIV style="POSITION : absolute">
<FORM id="Form1" method="post" runat="server">
<asp:datagrid id="dgEmployees " runat="server" Font-Size="X-Small"
BorderColor="Si lver" AllowSorting="T rue"
HorizontalAlign ="Center" BorderStyle="So lid" Height="136px"
Width="640px">
<SelectedItemSt yle Font-Underline="True " Font-Bold="True"></
SelectedItemSty le>
<AlternatingIte mStyle BackColor="#C0F FC0"></
AlternatingItem Style>
<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:LinkButt on id="Select" Text="Details"
CommandName="Sh owDetails" runat="server" />
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:datagrid></FORM>
</DIV>
</div>
<div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE:
medium; BORDER-LEFT-COLOR: white; LEFT: 869px; FLOAT: none; BORDER-
BOTTOM-COLOR: white; MARGIN-LEFT: 20px; OVERFLOW: auto; WIDTH: 277px;
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;
POSITION: absolute; TOP: 50px; HEIGHT: 598px; BACKGROUND-COLOR:
#c0ffc0; TEXT-ALIGN: left; BORDER-RIGHT-COLOR: white; BORDER-BOTTOM-
STYLE: inset"
align="left"><a sp:datalist id="dlDetails" runat="server" Font-
Size="X-Small" BorderColor="Si lver" Height="350px"
Width="309px" RepeatLayout="F low">
<ItemTemplate >
<B>Emp #: </B>
<%# Container.DataI tem("Key") %>
<br>
<B>First Name: </B>
<%# Container.DataI tem("FirstName" ) %>
<br>
<B>MI: </B>
<%# Container.DataI tem("MI") %>
<br>
<B>Last name: </B>
<%# Container.DataI tem("LastName") %>
<br>
<B>Nick Name: </B>
<%# Container.DataI tem("NickName") %>
<br>
<B>Use Nick Name Only: </B>
<%# Container.DataI tem("UseNickNam eOnly") %>
<br>
<B>DOB: </B>
<%# Container.DataI tem("DOBString" ) %>
<br>
<B>Start Date String: </B>
<%# Container.DataI tem("StartDateS tring") %>
<br>
<B>Longevity Date: </B>
<%# Container.DataI tem("LongevityD ate") %>
<br>
<B>Gender: </B>
<%# Container.DataI tem("Gender") %>
<br>
<B>Race: </B>
<%# Container.DataI tem("Race") %>
<br>
<B>Status: </B>
<%# Container.DataI tem("Status") %>
<br>
<B>Email Address: </B>
<%# Container.DataI tem("EmailAddre ss") %>
<br>
<B>Login Name: </B>
<%# Container.DataI tem("LoginName" ) %>
<br>
<B>Home Phone: </B>
<%# Container.DataI tem("HomePhoneF ormatted") %>
<br>
<B>Payroll Employee ID: </B>
<%# Container.DataI tem("PayrollEmp loyeeID") %>
<br>
<B>Retiree: </B>
<%# Container.DataI tem("Retiree") %>
<br>
<B>Retirement Number: </B>
<%# Container.DataI tem("Retirement Number") %>
<br>
<B>Service Date String: </B>
<%# Container.DataI tem("ServiceDat eString") %>
<br>
<B>Suffix: </B>
<%# Container.DataI tem("Sfx") %>
<br>
<B>Advance Leave: </B>
<%# Container.DataI tem("AdvanceLea ve") %>
<br>
<B>Benefits: </B>
<%# Container.DataI tem("Benefits") %>
<br>
<B>Cobra: </B>
<%# Container.DataI tem("Cobra") %>
<br>
<B>Evaluation Due: </B>
<%# Container.DataI tem("Evaluation DueString") %>
<br>
<B>Law Sep: </B>
<%# Container.DataI tem("LawSep") %>
<br>
<B>LOA: </B>
<%# Container.DataI tem("LOA") %>
<br>
<B>Added By: </B>
<%# Container.DataI tem("AddedBy") %>
<br>
<B>Added By Name: </B>
<%# Container.DataI tem("AddedByNam e") %>
<br>
<B>Added Date: </B>
<%# Container.DataI tem("AddedDateS tring") %>
<br>
<B>Ad Username: </B>
<%# Container.DataI tem("AdUsername ") %>
<br>
<B>Updated By: </B>
<%# Container.DataI tem("UpdatedBy" ) %>
<br>
<B>Updated By Name: </B>
<%# Container.DataI tem("UpdatedByN ame") %>
<br>
<B>Updated Date String: </B>
<%# Container.DataI tem("UpdatedDat eString") %>
<br>
</ItemTemplate>
</asp:datalist></div>
</BODY>
</HTML>
Code-Behind:
Public Class MainDepartment
Inherits System.Web.UI.P age
Private m_department As String
Private m_title As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
'lblWelcome.Tex t = "Hello " & Global.UserSecu rity.Fname.Trim &
" " & Global.UserSecu rity.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).G etActionCurrent (Global.UserSec urity.EmpId, Today,
Global.UserName , Global.UserPass word, Global.appDataS ource)
pos = (New PositionBroker) .GetPosition(ac t.PositionID,
Global.UserName , Global.UserPass word, Global.appDataS ource)
m_department = pos.Department. Name
Dim emps As Employees = (New
EmployeeBroker) .GetCurrentEmpl oyeesByDepartme nt(m_department ,
Global.UserName , Global.UserPass word, Global.appDataS ource)
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.Dat aSource = dt
dgEmployees.Dat aBind()
End Sub
Private Sub ShowDetails(ByV al sender As Object, ByVal e As
DataGridCommand EventArgs)
?????????
?????????
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).G etActionCurrent (dr.Key, Today, Global.UserName ,
Global.UserPass word, Global.appDataS ource)
Dim employee As DataRow = dt.NewRow
employee("Emp #") = dr.Key
employee("Last Name") = dr.LastName
employee("First Name") = dr.FirstName
employee("Title ") = EmpPos.WorkAgai nstInfo.Title
dt.Rows.Add(emp loyee)
End Sub 'SetListViewIte m
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(Em ployeeID,
Global.UserName , Global.UserPass word, Global.appDataS ource)
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.HandleEx ception(ex)
retval = String.Empty
End Try
Return retval
End Function
End Class