views:

341

answers:

1

Looking for an example or sample app of an ASP.NET page with a DataGridView with records. Each record has a hyperlink and clicking on a link, instead of showing the details of the record in the same page, opens a lightbox on top with a form showing the details.

A: 

This is a pretty specific example request which I am not sure someone can provide. However if you deconstruct it you are looking at something like:

  • create a grid that shows records
  • create a detail page for 1 specific record
  • link detail page to lightbox

I would advice you to develop it in this way since then you don't have to focus on very different things at once and secondly it will be much easier to find examples.

This article explains how to create the grid. Then you can add a link column with code like

  <asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="detail.aspx?id={0}"
                    DataTextField="Name" />

implementing the detail page is as simple as getting the id from the querystring and using it to query the detail info and dispaying it. Once this is all working you can foccus on the lightbox. If you use thickbox to diplay the lightbox it is as simple as adding a css class to the link to make it open in a lightbox.

Do use the iframe mode of thickbox since the ajax mode can give some problems in conjunction with asp.net webforms.

olle