Click here to Skip to main content
15,898,222 members
Articles / Web Development / ASP.NET

Cross-Tab Reports : Dynamically add columns to grid

Rate me:
Please Sign up or sign in to vote.
2.00/5 (5 votes)
9 Sep 20072 min read 38.8K   493   27  
Article describing how to work of girds which needs to add columns dynamically at run time.
main
{

	//Assign the datasource to the business object for report 1 implementation
	oGridView1.DataSource = oBusinessObject1;


	// Make the object of report1
	oBaseReport = new oRpt1; 


	// Make the object of cross star 
	// and pass report1 object and grid object 
	// to the construnction function
	oCrossStar = new CrossStar();
	crosStar.Construct(oBaseReport, oGridView1)

	//Bind the grid
	oGridView1.DataBind();

	//Assign the datasource to the business object for report 2 implementation
	oGridView2.DataSource = oBusinessObject2;

	// Make the object of report2
	oBaseReport = new oRpt2; 

	crosStar.Construct(oBaseReport, oGridView2)

	//Bind the grid
	oGridView2.DataBind();
}

class CrossStar
{
	Construct(oBaseReport, oGridView1)
	{
		oBaseReport.buildBindFields(oGridView1);
		oBaseReport.buildTemplateFields(oGridView1);
	}
}

abstract class BaseReport
{
	//Functions to add bind and template fields
	buildBindFields(oGridView1)
	buildTemplateFields(oGridView1)
}

class Rpt1: BaseReport
{
	//Implementation of functions to add bind and template fields
	//Implimentation based on report 1 structure
	buildBindFields(oGridView1)
	buildTemplateFields(oGridView1)
}

class Rpt2: BaseReport
{
	//Implementation of functions to add bind and template fields
	//Implimentation based on report 2 structure
	buildBindFields(oGridView1)
	buildTemplateFields(oGridView1)
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Unknown
Working in Microsoft technologies for the last 4 years

Comments and Discussions