Frage

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();
}
War es hilfreich?

Lösung

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;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top