private void BindReportColumn(String report_id) { dt = mda.GetData("SELECT column_name,column_text,size,back_color,fore_color FROM report_column INNER JOIN report ON report_column.report_id = report.report_id and report.report_id='" + report_id + "'", connStr).Tables[0]; GridCustomColumn.DataSource = dt; GridCustomColumn.DataBind(); }
private void addcolumn() { int i; //Add the items to the gridview DataTable dt = new DataTable(); //Assign the viewstate to the datatable if (!IsNumeric(txtcolumn_count.Text)) txtcolumn_count.Text = "0"; dt = (DataTable)ViewState["columnreport"]; for (i = 1; i <= Convert.ToInt32(txtcolumn_count.Text); i++) { DataRow dr = dt.NewRow(); //dr["report_id"] = txtreport_id.Text; dr["column_name"] = ""; dr["column_text"] = " "; dr["size"] = 0; dr["back_color"] = ""; dr["fore_color"] = ""; //Add the datarow to the datatable dt.Rows.Add(dr); //Now bind the datatable to the gridview GridCustomColumn.DataSource = dt; GridCustomColumn.DataBind(); //Add the details to viewstate also ViewState["columnreport"] = dt; } }