Пример #1
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int index = 0;

        foreach (GridViewRow gvr in GridView1.Rows)
        {
            if (index > 0)
            {
                TextBox type_vi = ((TextBox)gvr.FindControl("FunctionName_vi"));
                type_vi.Enabled = false;
                TextBox type_en = ((TextBox)gvr.FindControl("FunctionName_en"));
                type_en.Enabled = false;
                TextBox type_other = ((TextBox)gvr.FindControl("FunctionName_other"));
                type_other.Enabled = false;

                // Update to SQL
                t_Function entity_vi = new t_Function
                {
                    FunctionName = type_vi.Text,
                };
                string Id_vi        = (gvr.FindControl("FunctionId_vi") as HiddenField).Value;
                bool   updateStatus = functionBL.Update(entity_vi, int.Parse(Id_vi));

                t_Function entity_en = new t_Function
                {
                    FunctionName = type_en.Text,
                };
                string Id_en = (gvr.FindControl("FunctionId_en") as HiddenField).Value;
                updateStatus = functionBL.Update(entity_en, int.Parse(Id_en));

                t_Function entity_other = new t_Function
                {
                    FunctionName = type_other.Text,
                };
                string Id_other = (gvr.FindControl("FunctionId_other") as HiddenField).Value;
                updateStatus = functionBL.Update(entity_other, int.Parse(Id_other));
            }
            index++;
        }
    }
Пример #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         ntf.VisibleOnPageLoad = true;
         t_Function entity = new t_Function
         {
             FunctionName = txtFormName.Text,
             IsOnMenu     = (txtStatus.SelectedValue == "1") ? true : false,
         };
         bool   updateStatus = functionBL.Update(entity, functionId);
         string message      = (updateStatus) ? "Cập nhật thành công" : "Cập nhật không thành công";
         ntf.Text = message;
     }
 }