本文介绍了1列asp.net的GridView禁用编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的GridView编辑,编辑我在我的GridView控件的值,当我preSS编辑,所有列可编辑,我想列一个不允许进行编辑。

I am using a gridview Edit to edit the values i have in my gridview, when i press edit, all columns can be edited, i would like that one of the columns is not allowed to be edited.

有什么办法,我可以做到这一点?

Is there any way i can do this?

Thiss是我的aspx code:

Thiss is my aspx code:

<asp:GridView

ID="GridView1"
runat="server"
AllowSorting="True"
OnRowCommand="GridView1_SelectedIndexChanged1"
AutoGenerateEditButton="True"
OnRowCancelingEdit="GridView1_RowCancelingEdit"
CellSpacing="10"
OnRowUpdating="GridView1_RowUpdating" ShowFooter="True"
onselectedindexchanged="GridView1_SelectedIndexChanged"
OnRowEditing="GridView1_RowEditing">



</asp:GridView>

感谢

推荐答案

当然,利用EditItemTemplate里的。在下面的例子中ID字段不会在编辑模式下编辑:

Sure, make use of the EditItemTemplate. In the following example field ID will not be edited in the Edit mode:

<asp:GridView runat="server">
    <Columns>
        ...
        <asp:TemplateField HeaderText="ID">
            <EditItemTemplate>
                <%# Eval("ID") %>
            </EditItemTemplate>
        </asp:TemplateField>
        ...
    </Columns>
</asp:GridView>

这篇关于1列asp.net的GridView禁用编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 09:05