473,322 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Datagrid/Datalist, same page, 2nd is details

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></Divto allow scrolling of just the data, not the page. What I
need to do is place a DataList (also in a <Div></Divto 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.MainDepartme nt" %>
<!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
Jul 3 '08 #1
1 1864
I was able to get my DataList placed on my form to the right of the
DataGrid. Now all I need to figure out is how to put in a "Select"
column and when the user presses that for a specific employee record
the DataList will be populated with the rest of the fields. Any
clues? Thanks!!! Below is my revised code. The
code-behind has not been changed from my original post.

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="MainDepartment.aspx.vb"
Inherits="Forsyth.HR_ReportingTool.UI.MainDepartme nt" %>
<!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; LEFT: 50px; FLOAT: none; BORDER-
BOTTOM-COLOR: white; MARGIN-LEFT: 20px; OVERFLOW: auto; WIDTH: 736px;
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="Silver" AllowSorting="True"
HorizontalAlign="Center" BorderStyle="Solid" Height="136px"
Width="640px">
<SelectedItemStyle Font-Underline="True" Font-Bold="True"></
SelectedItemStyle>
<AlternatingItemStyle BackColor="#C0FFC0"></
AlternatingItemStyle>
</asp:datagrid></FORM>
</DIV>
</div>
<div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE:
medium; BORDER-LEFT-COLOR: white; LEFT: 800px; FLOAT: none; BORDER-
BOTTOM-COLOR: white; MARGIN-LEFT: 20px; OVERFLOW: auto; WIDTH: 326px;
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:
#ffcc66; TEXT-ALIGN: left; BORDER-RIGHT-COLOR: white; BORDER-BOTTOM-
STYLE: inset"
align="left"><asp:datalist id="dlDetails" Font-Size="X-Small"
BorderColor="Silver" Height="350px" runat="server"
Width="309px" RepeatLayout="Flow">
<ItemTemplate>
<B>Emp #: </B>
<%# Container.DataItem("Key") %>
<br>
<B>First Name: </B>
<%# Container.DataItem("FirstName") %>
<br>
<B>Last name: </B>
<%# Container.DataItem("LastName") %>
<br>
<B>Added By: </B>
<%# Container.DataItem("AddedBy") %>
<br>
<B>Added By Name: </B>
<%# Container.DataItem("AddedByName") %>
<br>
<B>Added Date: </B>
<%# Container.DataItem("AddedDateString") %>
<br>
<B>Ad Username: </B>
<%# Container.DataItem("AdUsername") %>
<br>
<B>Advance Leave: </B>
<%# Container.DataItem("AdvanceLeave") %>
<br>
<B>Benefits: </B>
<%# Container.DataItem("Benefits") %>
<br>
<B>Cobra: </B>
<%# Container.DataItem("Cobra") %>
<br>
<B>DOB: </B>
<%# Container.DataItem("DOBString") %>
<br>
<B>Email Address: </B>
<%# Container.DataItem("EmailAddress") %>
<br>
<B>Evaluation Due: </B>
<%# Container.DataItem("EvaluationDueString") %>
<br>
<B>Gender: </B>
<%# Container.DataItem("Gender") %>
<br>
<B>Home Phone: </B>
<%# Container.DataItem("HomePhoneFormatted") %>
<br>
<B>Law Sep: </B>
<%# Container.DataItem("LawSep") %>
<br>
<B>LOA: </B>
<%# Container.DataItem("LOA") %>
<br>
<B>Login Name: </B>
<%# Container.DataItem("LoginName") %>
<br>
<B>Longevity Date: </B>
<%# Container.DataItem("LongevityDate") %>
<br>
<B>MI: </B>
<%# Container.DataItem("MI") %>
<br>
<B>Nick Name: </B>
<%# Container.DataItem("NickName") %>
<br>
<B>Payroll Employee ID: </B>
<%# Container.DataItem("PayrollEmployeeID") %>
<br>
<B>Race: </B>
<%# Container.DataItem("Race") %>
<br>
<B>Retiree: </B>
<%# Container.DataItem("Retiree") %>
<br>
<B>Retirement Number: </B>
<%# Container.DataItem("RetirementNumber") %>
<br>
<B>Service Date String: </B>
<%# Container.DataItem("ServiceDateString") %>
<br>
<B>Suffix: </B>
<%# Container.DataItem("Sfx") %>
<br>
<B>Start Date String: </B>
<%# Container.DataItem("StartDateString") %>
<br>
<B>Status: </B>
<%# Container.DataItem("Status") %>
<br>
<B>Updated By: </B>
<%# Container.DataItem("UpdatedBy") %>
<br>
<B>Updated By Name: </B>
<%# Container.DataItem("UpdatedByName") %>
<br>
<B>Updated Date String: </B>
<%# Container.DataItem("UpdatedDateString") %>
<br>
<B>Use Nick Name Only: </B>
<%# Container.DataItem("UseNickNameOnly") %>
<br>
</ItemTemplate>
</asp:datalist></div>
</BODY>
</HTML>


On Jul 3, 11:45*am, Brock <wade.br...@yahoo.comwrote:
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></Divto allow scrolling of just the data, not the page. What I
need to do is place a DataList (also in a <Div></Divto 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 howcan 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.MainDepartme nt" %>
<!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
Jul 3 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andy | last post by:
Hello Guys: I am not sure if this is where the post belongs or not. I am using C# to write an ASP.Net page. I have an issue where I want to use a DataGrid, becasue of the Paging aspect, but...
1
by: Mihai_Panait | last post by:
I'm trying to build a commerce site and i can't understand why my DataList controls acts diferent with the same code in the same page My database contains amoung others 'category', 'subcategory' and...
3
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
5
by: tshad | last post by:
I want to use a datagrid with my display, but I don't want to use 1 row per record. What I have is a record with up to 6 values - (answer1,answer2,answer3,answer4,answer5,answer6). I want to...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
0
by: strout | last post by:
I have a mster-detail-detail dataset, for example, a dataset for all records of joining cusomer-order-orderdetails. I want to use ONE datagrid/datalist to hold the dataset , maybe one row is one...
0
by: saud ahmed via .NET 247 | last post by:
From: The Messiah. I have created a datalist that displays pictures in rows and columns i.e. X X X X X X X X X I have also created a:
1
by: WB | last post by:
Hi, I would like to do something like this page: http://www.stocklayouts.com/Products/Postcard/Postcard-Template-Design-Library.aspx?kwid=38 Notice when you mouse-over any of the icons under...
1
by: Brock | last post by:
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.