Datagrid item selection

S

slinky

I'm using VS2003 VB.net/ASP.net and have a Datagrid on an .ASPX page
that is successfully displaying the records I was expecting. The next
step I want to do is to double-click a line (record) and launch
another page that has the more details of that record displayed (and
of course only that record).

Can anyone give some lues or hyperlinks to accomplishing this? I've
heard of using DataView, but I don't think this is available in the
2003 version (?).

In case needed, here is my code:

<asp:datagrid id="dgEmployees" style="Z-INDEX: 103; LEFT: 12px;
POSITION: absolute; TOP: 12px"
runat="server" ShowHeader="False" BorderColor="Silver"
AllowSorting="True" HorizontalAlign="Center"
BorderStyle="Solid" Height="133px" Width="584px">
<SelectedItemStyle Font-Underline="True"></SelectedItemStyle>
<AlternatingItemStyle BackColor="#C0FFC0"></AlternatingItemStyle>
</asp:datagrid>


CODE BEHIND:

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("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("Last Name") = dr.LastName
employee("First Name") = dr.FirstName
employee("Title") = EmpPos.WorkAgainstInfo.Title
dt.Rows.Add(employee)
End Sub 'SetListViewItem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top