Making specific columns in gridview to be read-only is quite straight forward. But I just need to make first or a chosen row to be read-only. Is it possible to achieve this without affecting other editable rows.
Here's my current code. (sample)
<Columns>
<asp:CommandField ShowEditButton="True" HeaderText="Edit" />
<asp:BoundField DataField="Col1" ReadOnly="true" />
<asp:BoundField DataField="Col2" ReadOnly="false" />
<asp:BoundField DataField="Col3" ReadOnly="false" />
In the row perspective. First column is always read-only and other two rows are editable. I don't want an edit button to appear in the first row. I want the first row to be entirely read-only. How to achieve this?
EDIT:
If above is tough to achieve, then make then I am keen to know how first row in datatable can be added to footer row of gridview (assuming commandField will not add an edit button to footer...)
To make the first row non editable, you can use
RowDataBoundevent of the GridView and hide the Edit buttonFirst convert your
CommandFieldto aTemplateFieldand Hide the Edit Button inRowDataBoundevent,Try something like