Hi,

I am using dot net framework: 1.1 & VS-2003

I am working on a task in which I have to add to a check box column to a
Datagrid. I did spend some time in finding the way & I did make an attempt
with the following link,
http://www.vbdotnetheaven.com/UploadFile/sridhar_msd/CustomizingDatagrid07262007031305AM/CustomizingDatagrid.aspx
however I am not able to add it.  Please find below the code I have used,
In the Load event I am calling the following method,

private void PopulateDataGrid()

{

try

{

String Query;

DataSet Ds_Grid = new DataSet();;

OracleDataAdapter Ora_DA;

OracleConnection OraConn = new OracleConnection("Data Source=" +
CommonClass.ServerName + ";User Id=" + CommonClass.UserID + ";Password=" +
CommonClass.Password + ";");

OraConn.Open();

Query="Select Title,rpt_user_name from rptreport where RPT_USER_NAME =
'RPT_DEFAULT_USER' and Title like 'Confirmation%'";

Ora_DA = new OracleDataAdapter(Query,OraConn);

Ora_DA.Fill(Ds_Grid,"Tbl_ConfRptReports");

if (Ds_Grid.Tables["Tbl_ConfRptReports"].Rows.Count > 0)

{

dataGrid_Confirmations.DataSource= Ds_Grid.Tables["Tbl_ConfRptReports"];

}

OraConn.Close();

DataGridTableStyle Tabstyle = new DataGridTableStyle();

Tabstyle.MappingName = "rptreport";

DataGridBoolColumn ChkCol = new DataGridBoolColumn();

ChkCol.MappingName="Discontinued";

ChkCol.HeaderText="Select";

ChkCol.Width=30;

ChkCol.AllowNull=false;

Tabstyle.GridColumnStyles.Add(ChkCol);

DataGridTextBoxColumn TBCol1 =new DataGridTextBoxColumn();

TBCol1.MappingName="Title";

TBCol1.HeaderText="Report Title";

Tabstyle.GridColumnStyles.Add(TBCol1);

DataGridTextBoxColumn TBCol2 =new DataGridTextBoxColumn();

TBCol2.MappingName="rpt_user_name";

TBCol2.HeaderText="User Name";

Tabstyle.GridColumnStyles.Add(TBCol2);

//dataGrid_Confirmations.TableStyles.Clear();

dataGrid_Confirmations.TableStyles.Add(Tabstyle);

}

catch (Exception Ex)

{

MessageBox.Show(Ex.Message,CommonClass.ApplicationName,MessageBoxButtons.OK,MessageBoxIcon.Information);;

}

}


Can some one point me where I have done the mistake?


-- 
Thanks & Regards,
Karthikeyan

Reply via email to