protected void Statusgrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { string name, desc, id; int StatusId = 0; name = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; desc = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[2].Controls[0]).Text; id = Convert.ToString(Statusgrdvw.Rows[e.RowIndex].Cells[0].Text); StatusId = Convert.ToInt32(id); statusnamecount = ObjStatus.Get_By_StatusName(name); ObjStatus = ObjStatus.Get_By_id(StatusId); if ((statusnamecount == 0) && (name != "")) { ObjStatus.Statusid = StatusId; ObjStatus.Statusname = name; ObjStatus.Description = desc; ObjStatus.Update(); Statusgrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (name == "") { lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString(); } else if (ObjStatus.Statusname.ToLower() == name.ToLower()) { ObjStatus.Statusid = StatusId; ObjStatus.Statusname = name; ObjStatus.Description = desc; ObjStatus.Update(); Statusgrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else { lblerrmsg.Text = Resources.MessageResource.errStatusExist.ToString(); } }
protected void Statusgrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { string name, desc, id; int StatusId = 0; name = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; desc = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[2].Controls[0]).Text; id = Convert.ToString(Statusgrdvw.Rows[e.RowIndex].Cells[0].Text); StatusId = Convert.ToInt32(id); statusnamecount = ObjStatus.Get_By_StatusName(name); ObjStatus = ObjStatus.Get_By_id(StatusId); if ((statusnamecount == 0)&&(name!="")) { ObjStatus.Statusid = StatusId; ObjStatus.Statusname = name; ObjStatus.Description = desc; ObjStatus.Update(); Statusgrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (name == "") { lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString(); } else if (ObjStatus.Statusname.ToLower() == name.ToLower()) { ObjStatus.Statusid = StatusId; ObjStatus.Statusname = name; ObjStatus.Description = desc; ObjStatus.Update(); Statusgrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else { lblerrmsg.Text = Resources.MessageResource.errStatusExist.ToString(); } }