I am dynamically generating the RadGrid. Everything is dynamic.
I have kept the autogenerateColumns property false. And i have dounded only one column. But when my page renders it shows all the columns in the database.But actually i want only one column. I have pasted the code below.
TableRow
objTR = new TableRow();
ControlToAdd.Controls.Add(objTR);
TableCell objTC;
DataTable forGridDT = new DataTable();
forGridDT =
Common.getDataTableByList(listQuery, ListName,ListColumns);
//I am getting the data from the share point. Which is returning me the all columns with values.
RadGrid RadGrid1 = new RadGrid();
RadGrid1.ID = objRadGrid
RadGrid1.AllowPaging = true;
RadGrid1.AutoGenerateColumns =
false;
RadGrid1.DataSource = forGridDT;
RadGrid1.DataBind();
GridBoundColumn boundColumn = new GridBoundColumn();
boundColumn.DataField =
"Category";
//boundColumn.DataType =Type.st;
boundColumn.HeaderText =
"Category";
boundColumn.UniqueName =
"Category";
RadGrid1.MasterTableView.Columns.Clear();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
objTC =
new TableCell();
objTC.Width =
new Unit("100%");
objTC.Controls.Add(RadGrid1);
objTR.Controls.Add(objTC);