473,805 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid item selection

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="Fal se" BorderColor="Si lver"
AllowSorting="T rue" HorizontalAlign ="Center"
BorderStyle="So lid" Height="133px" Width="584px">
<SelectedItemSt yle Font-Underline="True "></SelectedItemSty le>
<AlternatingIte mStyle BackColor="#C0F FC0"></AlternatingItem Style>
</asp:datagrid>
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.Text = "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 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).G etActionCurrent (dr.Key, Today, Global.UserName ,
Global.UserPass word, Global.appDataS ource)
Dim employee As DataRow = dt.NewRow
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
Jun 27 '08 #1
0 1336

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

Similar topics

8
7937
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the header of the datagrid in the "ItemDataBound" method of the grid. However, once, they are added in the grid, i seem to lose the event handler for the same control. Is there anyone who has tried this before and knows why this is hapenning ??
5
3538
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all selected items of that listbox and display it. can anyone help? Thanks
3
2380
by: Zachary Hilbun | last post by:
I'm using a DataGrid control in a web form. I can display it using binding but when I click on any of the items there is no feedback that that row has been selected. I changed SelectedItemStyle but the changes do not appear when a row is clicked. What do I need to do to get it to do selection? =================================================== Zachary Hilbun Software Consultant http://www.vianova.com Via Nova OpenGL,...
1
2127
by: thegame | last post by:
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls Hello, I have an interesting dilemma. I have an ASPX page with two user controls (two ASCXs). Both ASCXs have DataGrids on them. The first user control's DataGrid is populated from our database on page load. The DataGrid also has a Select LinkButton.
13
2500
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for them. In a plain vanilla DataGrid, when you click on the RowHeader, the appropriate row changes colors. I ASSUME this should be done in the Paint (or PaintText) override of the DataGridColumnStyle in question. My problem is that I don't know...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7644
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.