Hi
I have below Gridview & i want only last column Date to be editable
DataTable BookPlanningResult = sQLUtility.GeBookPlanningRecommendation(vRpl, BookCollection, StudentCollection).Tables[0];
if (BookPlanningResult != null)
{
DataColumn Remarks = new DataColumn("Remarks", typeof(string));
BookPlanningResult.Columns.Add(Remarks);
DataColumn Dates = new DataColumn("Date", typeof(DateTime));
BookPlanningResult.Columns.Add(Dates);
grdPlanning.DataSource = BookPlanningResult;
grdPlanning.Columns[grdPlanning.Columns.Count - 1].ReadOnly = false;
grdPlanning.DataBind();
}
Thanks
Tuhin PaulPosted May 1, 2023, 6:47 PM
See the code:
You also need to add the OnRowDataBound event to the GridView control:
This code will set the ReadOnly attribute to true for all the columns except for the last column in each row of the GridView, which will be set to false. This will make only the last column editable.
Tuhin PaulPosted May 1, 2023, 6:46 PM
To make only the last column in the GridView editable, you can set the ReadOnly property of all the columns to true except for the last column.
Vishal YelvePosted Apr 30, 2023, 8:00 AM
Hi refer below links
https://stackoverflow.com/questions/14935765/editing-one-column-of-data-grid-view
https://www.aspsnippets.com/Articles/Make-one-Single-Specific-column-Editable-in-ASPNet-GridView.aspx