473,396 Members | 1,861 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,396 software developers and data experts.

datagrid - accessing data in a row


Hi.

I am sitting here in a company with many people, but no othe
programmers least of all asp.net ones.

I have created a 'view' form on the INTRAnet, where many lines ar
displayed in a datagrid (SeLECT statement built in code and the Datase
bound to datagrid).

I just need to allow the user to click a row, whereupon I take the ke
from a field in that row and open up a Detail page.

I cannot find a way. OK, there is clientside and serverside scope, bu
there must be a way to do this.

Possible?

Help greatly appreciated.

Gre
-
gregoryenelso
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Nov 18 '05 #1
1 951
Greg,

On server side use ItemDataBound event to setup a javasript onclick event
handler for every cell in the row. Example:

private void dgList_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["onclick"] = "onRowClick(this)";
}

On client side in onRowClick(this) change the row visual properties to make
it visualy selected and save the key column value in a variable. If the grid
doesn't show the key value, pass it in an invisible column. When you need to
open the detail page, do it with showModalDialog call and pass the saved key
as a parameter.

Eliyahu

"gregoryenelson" <gr*******************@mail.codecomments.com> wrote in
message news:gr*******************@mail.codecomments.com.. .

Hi.

I am sitting here in a company with many people, but no other
programmers least of all asp.net ones.

I have created a 'view' form on the INTRAnet, where many lines are
displayed in a datagrid (SeLECT statement built in code and the Dataset
bound to datagrid).

I just need to allow the user to click a row, whereupon I take the key
from a field in that row and open up a Detail page.

I cannot find a way. OK, there is clientside and serverside scope, but
there must be a way to do this.

Possible?

Help greatly appreciated.

Greg

--
gregoryenelson
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 18 '05 #2

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

Similar topics

0
by: Dhiman | last post by:
Hi , I have Datagrid bound to ADODB in Visual Basic 6 accessing MS Access database. My problem is when Datagrid is bound to any dataset...any change in datagrid contents immediately reflecting...
1
by: TB | last post by:
Relatively new to .NET so please bear with me... I'm making an ASP.NET web application and am using VB to code. I'll try to set the stage here... The class and property names are generic to make...
3
by: Ruy Castelli | last post by:
Hello, I'm trying to get the details out of a datagrid component and it works fine when I'm accessing the first page of the datagrid, but when I try to click on the details hyperlink for an item...
2
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four...
8
by: Jeff | last post by:
Hi - I'm having trouble Databinding a SQLDataReader to a DataGrid control. I have an ASP.NET web page accessing a SQL database. I've used VS to build the app and stored it in a directory of...
0
by: Bob Davies | last post by:
Hi I have a webservice that retrieves data from a database, this is then returned to the calling client application built in windows forms within a dataset, however upon attempting to create...
2
by: shuckjunkmail | last post by:
It was suggested that I re-submit this question as a new post rather than adding onto an old and unanswered post. The basic problem has to do with the .NET datagrid and sorting. I am having...
0
by: Mythran | last post by:
I have seen many examples on the Internet that do the following to format data being bound to a DataGrid....IMO, it's sick.. Public Sub MyGrid_ItemDataBound( ... ) Dim value As String =...
6
by: p.mc | last post by:
Hi all, I'm having major problems with a userControl which contains a datagrid. My problem concerns data binding. The Page_Load() procedure calls the DataBind procedure to bind the datagrid...
2
by: =?Utf-8?B?dmJ0cnlpbmc=?= | last post by:
Is it possible to add a new row programmatically to a datagrid, then store the new row data to the database? My app needs to prompt the user to add a new row - fill in the required fields in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.