I want to delete specific column from my datable before bounding it to a grid view. I tried with
finalTable.Columns.RemoveAt(0);
finalTable.Columns.RemoveAt(1);
but it does not delete rows values belonging to that column..
How can we delete column with row values??
EDIT: After bounding it to gridview rows are displayed in 3rd column.
give this a try:
DataTable example;
example.Columns.Remove("columnName");
example.Columns.RemoveAt(columnIndex);
Try this:
If(finalTable.Columns.CanRemove(finalTable.Columns[0]))
{
finalTable.Columns.RemoveAt(0);
}
finalTable.AcceptChanges()
Then bind it with your gridview
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.