在我的gridview中,五列中只有两列或可编辑模式,其余三列为不可编辑模式(asp.net,CSharp) [英] In my gridview five columns only two columns or editable mode remaining three colums non editable mode (asp.net,CSharp)

查看:90
本文介绍了在我的gridview中,五列中只有两列或可编辑模式,其余三列为不可编辑模式(asp.net,CSharp)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的所有专家,

在我的网格视图中,只有五列,只有两列或可编辑模式,其余三个列为不可编辑模式(asp.net,CSharp),但按钮位于网格视图之外.

感谢您的宝贵重播

Dear All Experts,

In my grid view five columns only two columns or editable mode remaining three colums non editable mode (asp.net,CSharp) but button is taken outside the grid view.

Thank u for your valuable replay

推荐答案

制作要编辑为的行:
datagridview1.Rows [row] .Cells ["ID"].EditedFormattedValue = true;
不要将make row编辑为:
datagridview1.Rows [row] .Cells ["ID"].EditedFormattedValue = false;
make rows which you want to edit as:
datagridview1.Rows[row].Cells["ID"].EditedFormattedValue = true;
to not edit make row as :
datagridview1.Rows[row].Cells["ID"].EditedFormattedValue = false;


Subbu1999写道:
Subbu1999 wrote:

在我的网格视图中只有五列,只有两列或可编辑模式其余三列为不可编辑模式

In my grid view five columns only two columns or editable mode remaining three colums non editable mode

将列设为Readonly.

Make the columns Readonly.

由于相关BoundField中的 ReadOnly ="True" 设置, ProductID 列不可编辑.

The ProductID column is non-editable due to the ReadOnly="True" setting in the associated BoundField.

<asp:GridView ID="GridView1" Runat="server"

    DataSourceID="productDataSource" DataKeyNames="ProductID"

    AutoGenerateColumns="False" AllowPaging="True"

    BorderWidth="1px" BackColor="White"

    CellPadding="4" BorderStyle="None" BorderColor="#3366CC">
    <FooterStyle ForeColor="#003399"

       BackColor="#99CCCC"></FooterStyle>
    <PagerStyle ForeColor="#003399" HorizontalAlign="Left"

       BackColor="#99CCCC"></PagerStyle>
    <HeaderStyle ForeColor="#CCCCFF" Font-Bold="True"

       BackColor="#003399"></HeaderStyle>
    <Columns>
        <asp:CommandField ShowEditButton="True"></asp:CommandField>
        <asp:BoundField ReadOnly="True" HeaderText="ProductID"

            InsertVisible="False" DataField="ProductID"

            SortExpression="ProductID"></asp:BoundField>
        <asp:BoundField HeaderText="Product"

            DataField="ProductName"

            SortExpression="ProductName"></asp:BoundField>
        <asp:BoundField HeaderText="Unit Price"

            DataField="UnitPrice" SortExpression="UnitPrice">
            <ItemStyle HorizontalAlign="Right"></ItemStyle>
        </asp:BoundField>
        <asp:BoundField HeaderText="Units In Stock"

           DataField="UnitsInStock" SortExpression="UnitsInStock">
            <ItemStyle HorizontalAlign="Right"></ItemStyle>
        </asp:BoundField>
    </Columns>
    <SelectedRowStyle ForeColor="#CCFF99" Font-Bold="True"

        BackColor="#009999"></SelectedRowStyle>
    <RowStyle ForeColor="#003399" BackColor="White"></RowStyle>
</asp:GridView>


这篇关于在我的gridview中,五列中只有两列或可编辑模式,其余三列为不可编辑模式(asp.net,CSharp)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆