Wednesday, August 11, 2010

How to create a dynamic report using a datagrid in ASP.Net?

I want to display a dynamic report using datagrid. i.e ten check boxes will be present in a web page representing column names of a table and based on the selection of these check boxes, corresponding columns should be chosen from an access table and displayed in a datagrid. The selection of check boxes might vary each time but correct number of columns should be displayed in the datagrid dynamically. How to go about it?How to create a dynamic report using a datagrid in ASP.Net?
First, you will need to use dynamic sql to build your query based on the selected check boxes (columns) because the columns in your select statement will need to be dynamic.





Second, you will need to use the sql statement you create to fill an untyped dataset.





Finally, bind the dataset to your datagrid and make sure that the ';autogeneratecolumns'; value is set to true.

No comments:

Post a Comment