我知道GridView1.EditIndex = e.NewEditIndex将在编辑模式下设置整个行,但是我想要的是我可以在行中设置特定的列。请以以下示例为例:
TITLE ---- DESCRIPTION ---- QUANTITY
Row1
Row2
Row3
我想将Row2的QUANTITY设置为编辑模式。我怎样才能做到这一点?是否有可能?
<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/zh-cn/library/system.web.ui.webcontrols.boundfield.readonly(v=vs.100).aspx
您可以像上面一样将特定的列设置为只读。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句