ASP.Net GridView Drillthrough

Associate
Joined
25 Feb 2007
Posts
905
Location
Midlands
Hi All,

I have a GridView in my webapp which displays data from a SQL datasource. The datasource is set via code (as opposed to the markup - apologies if my terminology is incorrect).

What I'd like to be able to do is when the user clicks on data in the row, the GridView datasource changes based on what was clicked, and the GridView updated to show the new data.

This may not be the best way to do this and if so I'm open to suggestions. Ultimately I need to be able to 'drillthrough' from the initial data to display a breakdown of the selected row.

How could I do this? This is in C#.

Thanks :D,
 
Thanks for the replies both.

I'm creating a dataset from a SQL query and binding this to the GridView (should I not be using this?), by setting the GridView's datasource to be the above dataset and then using GridView.DataBind().

Bit of background to what I'm trying to achieve - I'm trying to replicate a Reporting Services report (because it needs to be cleverer than SSRS will allow e.g. filtering the report based on the user logged in, aslong as that user is part of a certain AD group etc.) The report I'm trying to replicate allows the user to click on the numerical values and links to another report which shows a breakdown of the value clicked.

For example:

Report 1 shows -

Vegetables 10
Fruit 6
Other 4

Clicking on '10' takes you to Report 2, which shows -

Lettuce 3
Carrots 2
Onions 5

Therefore, I was thinking that I need to use some sort of OnClick/RowClick event of the GridView, but it doesn't seem to have these? To make it seemless, I was hoping to just update the SQL query (which is a string) and run GridView.DataBind() again, although I'm not sure if that would work?

As I said, if there is a better way to achieve this, I'm open to suggestions! :D
 
Back
Top Bottom