DetailView 怎么由只读模式进入编辑模式

2020-07-13 11:25发布

问题:

    protected void Page_Load(object sender, EventArgs e)
    {
        Tuan.BLL.MerchantInfo merBLL = new Tuan.BLL.MerchantInfo();
        DataTable table = merBLL.GetList("ID=" + 3).Tables[0];
        DetailsView1.DataSource = table;
        DetailsView1.DataBind();
    }
    protected void DetailsView1_ModeChanging(object sender, DetailsViewModeEventArgs e)
    {
        DetailsView1.DefaultMode = DetailsViewMode.Edit;

    }


        <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" 
            onmodechanging="DetailsView1_ModeChanging">
            <Fields>
                <asp:CommandField ShowEditButton="True" />
            </Fields>
        </asp:DetailsView>

为什么我的detailView点击编辑的时候进入不了编辑的状态?

回答1:

像WinForm里的DataGridView是有  是否可编辑 这样的属性的