//Gridview编辑 protected void Grid_Third_RowUpdating(object sender, GridViewUpdateEventArgs e) { Guid cDTLC_ID = new Guid(Grid_Third.DataKeys[e.RowIndex].Value.ToString()); //string cDTLC_DocType = Convert.ToString(((TextBox)(Grid_Third.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim()); string cDTLC_DocType = Convert.ToString(Grid_Third.Rows[e.RowIndex].Cells[1].Text.Trim().ToString()); string cDTLC_Code = Convert.ToString(((TextBox)(Grid_Third.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim()); //文件类别不为空 //if (((TextBox)(Grid_Third.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim().ToString() == "") //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('文件类别不能为空!')", true); // return; //} //文件类别代码不为空 if (((TextBox)(Grid_Third.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim().ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('文件类别代码不能为空!')", true); return; } //DataSet ds = basicCodeL.Search_CDThirdLevelCode("and (CDTLC_DocType != '" + cDTLC_DocType + " 'and CDTLC_Code='" + cDTLC_Code + "') or (CDTLC_DocType = '" + cDTLC_DocType + " ' and CDTLC_Code='" + cDTLC_Code + "')"); DataSet ds = basicCodeL.Search_CDThirdLevelCode("and CDTLC_Code='" + cDTLC_Code + "'"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('已有此代码,不能重名!')", true); return; } Grid_Third.EditIndex = -1; basicCodeL.Update_CDThirdLevelCode(cDTLC_ID, cDTLC_DocType, cDTLC_Code); BindGrid_Third(""); UpdatePanel_Third.Update(); }
protected void Btn_NewThird_Click(object sender, EventArgs e) { Grid_Third.EditIndex = -1; Grid_Third.SelectedIndex = -1; BindGrid_Third(""); UpdatePanel_Third.Update(); Clear(); Panel_NewThird.Visible = true; UpdatePanel_NewThird.Update(); }
protected void Btn_ClearThird_Click(object sender, EventArgs e) { Grid_Third.EditIndex = -1; TextType.Text = ""; TextDocCode.Text = ""; BindGrid_Third(""); UpdatePanel_Third.Update(); Panel_NewThird.Visible = false; UpdatePanel_NewThird.Update(); }
protected void Btn_SearchThird_Click(object sender, EventArgs e) { Grid_Third.EditIndex = -1; string condition = GetCondition3(); BindGrid_Third(condition); Panel_Third.Visible = true; UpdatePanel_Third.Update(); Panel_NewThird.Visible = false; UpdatePanel_NewThird.Update(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Title = "受控文件基础数据维护"; BindGrid_BDOS(""); BindDropDownList1(); UpdatePanel_BDOS.Update(); BindGrid_CDDep(""); //BindDropDownList3(); UpdatePanel_CDDep.Update(); BindGrid_Third(""); UpdatePanel_Third.Update(); try { if (Request.QueryString["status"].ToString() != "") { Lab_Status.Text = Request.QueryString["status"].ToString(); } if (Lab_Status.Text == "BasicCode" && Session["UserRole"].ToString().Contains("受控文件基础数据维护")) { Title = "受控文件基础数据维护"; } if (Lab_Status.Text == "BasicLook" && Session["UserRole"].ToString().Contains("受控文件基础数据查看")) { Title = "受控文件基础数据查看"; Btn_NewBDOS.Visible = false; Grid_BDOS.Columns[4].Visible = false; Grid_BDOS.Columns[5].Visible = false; Btn_NewCDDep.Visible = false; Grid_CDDep.Columns[3].Visible = false; Grid_CDDep.Columns[4].Visible = false; Btn_NewThird.Visible = false; Grid_Third.Columns[3].Visible = false; Grid_Third.Columns[4].Visible = false; } } catch (Exception) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('可能您没有权限操作和查看本页面,请退出选择其他账号登陆,或联系管理员!')", true); Response.Redirect("~/Default.aspx"); } } }
//新增确认 protected void BtnOK_NewThird_Click(object sender, EventArgs e) { if (newType.Text.ToString() == "" || newDocCode.Text.ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('标记*的为必填项,请填写完整!')", true); return; } string cDTLC_DocType = newType.Text.ToString(); string cDTLC_Code = newDocCode.Text.ToString(); DataSet ds = basicCodeL.Search_CDThirdLevelCode("and (CDTLC_DocType = '" + cDTLC_DocType + "' or CDTLC_Code = '" + cDTLC_Code + "')"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('已有此文件类别代码,不能重复!')", true); return; } basicCodeL.Insert_CDThirdLevelCode(cDTLC_DocType, cDTLC_Code); BindGrid_Third(""); UpdatePanel_Third.Update(); Panel_NewThird.Visible = false; UpdatePanel_NewThird.Update(); }
//取消编辑 protected void Grid_Third_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { Grid_Third.EditIndex = -1; UpdatePanel_Third.Update(); BindGrid_Third(""); }