I am binding the data in a data table from two different datagrid
protected ICollection BindGenerateReport()
{
DataTable dtGenerateReport = new DataTable();
DataRow drRow;
for (int innerCounter = 0; innerCounter < dgInvoices.Columns.Count; innerCounter++)
{
dtGenerateReport.Columns.Add();
}
for (int counter = 0; counter < dgInvoices.Items.Count+dgReceipts.Items.Count;counter++ )
{
drRow = dtGenerateReport.NewRow();
if (dgReceipts.Columns[6] == dgInvoices.Columns[1])
{
for (int innerCounter = 0; innerCounter < dgReceipts.Columns.Count; innerCounter++)
{
drRow[innerCounter] = dgReceipts.Columns[innerCounter];
}
}
else
{
for (int innerCounter = 0; innerCounter < dgInvoices.Columns.Count; innerCounter++)
{
drRow[innerCounter] = dgInvoices.Columns[innerCounter];
}
}
dtGenerateReport.Rows.Add(drRow);
}
DataView dv = new DataView(dtGenerateReport);
return dv;
}
and i am binind the function a event click like that
protected void btnGenerateReport_Click(object sender, EventArgs e)
{
dgGenerateReport.DataSource = BindGenerateReport();
dgGenerateReport.DataBind();
}
but i want to know that what exactlu datagrid.columns[number] returns (the value inside that column or the datatype or only the column collection ).My code is not working