Last post Aug 29, 2010 02:02 AM by nwallaq
Aug 28, 2010 05:16 PM|nwallaq|LINK
added a dataset.xsd file, kept a datatable in it, nothing else
binded the dataset as a datasource for the srystalreport1.rpt
now my aim is to, make the dataset populated by code to appear in the report (note the gridview does recongize the change, also note i have tried using the init page method but no luck)
heres the code behind.
DataSet1 ds = new DataSet1();
int i = 0;
//dt = new DataTable();
idCoulumn = new DataColumn("ID", Type.GetType("System.Int32"));
nameCoulumn = new DataColumn("Name", Type.GetType("System.String"));
dr = ds.DataTable1.NewRow();
dr["ID"] = 1;
dr["Name"] = "Name1";
dr["ID"] = 2;
dr["Name"] = "Name2";
GridView grid1 = new GridView();
grid1.DataSource = ds;
protected void Page_Load(object sender, EventArgs e)
//try to bind it again BUT NO LUCK!
Aug 29, 2010 01:26 AM|shiningstar|LINK
try the follwing:
CrystalReportSource1.DataTable = ds.Tables;
hope it helps you.
Mark as answer if it helps you.
Aug 29, 2010 02:02 AM|nwallaq|LINK
by doing this would mean, i am changing the data source from crystalrep...rpt to the dataset??
is there a way to do that will it work, if the datasource is set to the ds.table instead of rpt
as i remember design view doesnot bind with anything else excep rpt file
will coding help?
sry of sch a quest, bt crrently dont hv vs08 to try out
thank you for the help