예제 #1
0
    protected void gvWordTranslate_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int         index   = gvWordTranslate.EditIndex;
        GridViewRow row     = gvWordTranslate.Rows[index];
        Label       txtId   = (Label)gvWordTranslate.Rows[e.RowIndex].FindControl("txtId");
        TextBox     txtName = (TextBox)gvWordTranslate.Rows[e.RowIndex].FindControl("txtName");

        WordTranslate o = WordTranslate.GetWordTranslateById(int.Parse(txtId.Text));

        o.Name = txtName.Text;
        int i = WordTranslate.Update(o);

        if (i > 0)
        {
            lblSuccess.Visible = true;
            lblError.Visible   = false;
        }
        else
        {
            lblSuccess.Visible = false;
            lblError.Visible   = true;
        }

        gvWordTranslate.EditIndex = -1;
        BindWordTranslate();
    }