문제

For some reason the code that I have below does not change the mode from edit mode to display mode once update is complete. Please advise.

protected void gridData_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem editItem = (GridEditableItem)e.Item;
    GridEditManager editMan = editItem.EditManager;

    Label lblDataId = editItem.FindControl("lblDataId") as Label;
    TextBox txtDataName = editItem.FindControl("txtDataName ") as TextBox;

    string dataName = txtDataName.Text;

    int dataId = Convert.ToInt32(lblDataId .Text);
    stateBLL.UpdateState(dataId, dataName);

    gridData.DataBind();
}
도움이 되었습니까?

해결책

The row will stay on "edit mode" unless you explicitly revert it back to "view mode". Try setting it to "view mode" when you finish updating, just before the gridData.DataBind(); line add the following line of code...

e.Item.Edit = false;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top