Reputation: 699
I know that GridView1.EditIndex = e.NewEditIndex will set the whole row in edit mode but what I wanted is that I can set the specific Column in a Row. Please take the below example:
TITLE ---- DESCRIPTION ---- QUANTITY
Row1
Row2
Row3
I want to set QUANTITY of Row2 to be in edit mode. How can I do that? Is it possible?
Upvotes: 0
Views: 1629
Reputation: 621
<asp:gridview id="CustomersGridView"
datasourceid="CustomersSqlDataSource"
autogeneratecolumns="false"
autogenerateeditbutton="true"
allowpaging="true"
datakeynames="CustomerID"
runat="server">
<columns>
<asp:boundfield datafield="CustomerID"
readonly="true"
headertext="Customer ID"/>
<asp:boundfield datafield="CompanyName"
convertemptystringtonull="true"
headertext="Customer Name"/>
<asp:boundfield datafield="Address"
convertemptystringtonull="true"
headertext="Address"/>
<asp:boundfield datafield="City"
convertemptystringtonull="true"
headertext="City"/>
<asp:boundfield datafield="PostalCode"
convertemptystringtonull="true"
headertext="ZIP Code"/>
<asp:boundfield datafield="Country"
convertemptystringtonull="true"
headertext="Country"/>
</columns>
</asp:gridview>
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.readonly(v=vs.100).aspx
You can set the specific column readonly like above.
Upvotes: 1
Reputation: 1906
Check out these below links from MSDN. Hope it will help you.
http://msdn.microsoft.com/en-us/library/stk0x9y3(v=vs.100).ASPX
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview(v=vs.110).aspx
Upvotes: 0