I have a gridview and and I am creating it dynamically, I get parent and child tables records and binding the data to a single data grid view. I need to indent the row which is from child table a bit to the right so that i can differentiate the record from parent record.
private void CreateDynamicGridView(DataTable tables, GridView gv)
{
try
{
DataTable _dtSearchList = tables;
strColumnCount = _dtSearchList.Columns.Count.ToString();
foreach (DataColumn col in _dtSearchList.Columns)
{
BoundField bfield = new BoundField();
bfield.DataField = col.ColumnName;
bfield.HeaderText = col.ColumnName;
gv.Columns.Add(bfield);
}
gv.DataSource = _dtSearchList;
gv.DataBind();
}
catch (Exception ex)
{
}
}
I did as follows,