protected void Btn_confirm_areal_Click(object sender, EventArgs e) { if (TextBox_ArealName.Text.Trim().ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('区域名称不能为空!')", true); return; } else { DataSet ds = PSB.SList_Imstore_ArealName(TextBox_ArealName.Text.Trim().ToString(), areal_guid); DataTable dt = ds.Tables[0]; DataView dv = ds.Tables[0].DefaultView; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该区域名称,不能重名!')", true); return; } else { imssdinfo.IMS_StoreID = areal_guid; imssdinfo.IMSA_AreaName = TextBox_ArealName.Text.Trim().ToString(); imssdinfo.IMSA_Remark = TextBox_ArealDetail.Text.Trim().ToString(); imssdinfo.IMSA_MakeMan = Session["UserName"].ToString(); PSB.I_IMstoreAreal(imssdinfo); GridView_areal.DataSource = PSB.S_STOREareal(areal_guid); GridView_areal.DataBind(); UpdatePanel_areal.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('添加区域成功!')", true); return; } } }
}//编辑//当为commandField时使用这种,为模板列连接按钮使用rowcommand根据command那么不同来操作 protected void GridView_areal_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) {//取消编辑状态的事件 GridView_areal.EditIndex = -1; GridView_areal.DataSource = PSB.S_STOREareal(areal_guid); GridView_areal.DataBind(); UpdatePanel_areal.Update(); }//取消编辑//当为commandField时使用这种,为模板列连接按钮使用rowcommand根据command那么不同来操作
}//databind ,用于获取dept表行索引 #endregion #region 区域表后台事件 protected void GridView_areal_RowEditing(object sender, GridViewEditEventArgs e) {//激活编辑按钮的事件 GridView_areal.EditIndex = e.NewEditIndex; GridView_areal.DataSource = PSB.S_STOREareal(areal_guid); GridView_areal.DataBind(); UpdatePanel_areal.Update(); }//编辑//当为commandField时使用这种,为模板列连接按钮使用rowcommand根据command那么不同来操作
protected void Btn_cancel0_Click(object sender, EventArgs e) { Panel_areal.Visible = false; Panel_arealedit.Visible = false; Panel_newareal.Visible = false; UpdatePanel_areal.Update(); UpdatePanel_arealedit.Update(); UpdatePanel_newareal.Update(); }
}//取消编辑//当为commandField时使用这种,为模板列连接按钮使用rowcommand根据command那么不同来操作 protected void GridView_areal_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridView_areal.EditIndex = -1; imssdinfo.IMSA_AreaID = new Guid(GridView_areal.DataKeys[e.RowIndex].Value.ToString()); imssdinfo.IMSA_AreaName = Convert.ToString(((TextBox)(GridView_areal.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim().ToString()); imssdinfo.IMSA_Remark = Convert.ToString(((TextBox)(GridView_areal.Rows[e.RowIndex].Cells[3].Controls[0])).Text.Trim().ToString()); imssdinfo.IMSA_MakeMan = Session["UserName"].ToString(); PSB.U_IMstore_Areal(imssdinfo); GridView_areal.DataSource = PSB.S_STOREareal(areal_guid); GridView_areal.DataBind(); UpdatePanel_areal.Update(); //this.UpdatePanel_IMSSBD.Update(); }//更新//当为commandField时使用这种,为模板列连接按钮使用rowcommand根据command那么不同来操作
}//databind ,用于调整格式 protected void GridView_areal_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete3") { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_IMStore.SelectedIndex = row.RowIndex; GridView_IMStore.SelectedIndex = -1; string id = e.CommandArgument.ToString(); Guid guid_id = new Guid(id); PSB.D_IMstore_Areal(guid_id); GridView_areal.DataSource = PSB.S_STOREareal(areal_guid); GridView_areal.DataBind(); UpdatePanel_areal.Update(); UpdatePanel_arealedit.Update(); } }
protected void GridView_areal_PageIndexChanging(object sender, GridViewPageEventArgs e) //出入库类别表,下一页,上一页等跳转后台 { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; if (-2 == e.NewPageIndex) { // when click the "GO" Button TextBox txtNewPageIndex = null; GridViewRow pagerRow = GridView_areal.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); // refer to the TextBox with the NewPageIndex value } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex } } else { // when click the first, last, previous and next Button newPageIndex = e.NewPageIndex; } // check to prevent form the NewPageIndex out of the range newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= GridView_areal.PageCount ? GridView_areal.PageCount - 1 : newPageIndex; // specify the NewPageIndex GridView_areal.PageIndex = newPageIndex; GridView_areal.PageIndex = newPageIndex; GridView_areal.DataSource = PSB.S_STOREareal(areal_guid); GridView_areal.DataBind(); UpdatePanel_areal.Update(); } //读取go前textbox,导航到指定页面
protected void GridView_IMStore_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "bianji") { flag_STOre = 0; Session["store11_id"] = e.CommandArgument.ToString(); GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_IMStore.SelectedIndex = row.RowIndex; GridView_IMStore.SelectedIndex = -1; string Store_name = row.Cells[1].Text.Trim().ToString(); i = 0; TextBox_Store.Text = Store_name; TextBox_Store.ReadOnly = true; TextBox_Store.Enabled = false; TextBox_StoreManger.Text = ""; TextBox_StoreManger0.Text = ""; TextBox_StoreManger.ReadOnly = true; TextBox_StoreManger.Enabled = false; TextBox_StoreManger0.ReadOnly = true; TextBox_StoreManger0.Enabled = false; Panel_EditStore.Visible = true; UpdatePanel_EditStore.Update(); } else if (e.CommandName == "dele") { string id = e.CommandArgument.ToString(); Guid guid_id = new Guid(id); PSB.D_IMstore(guid_id); GridView_IMStore.DataSource = PSB.SList_Istore(); GridView_IMStore.DataBind(); UpdatePanel_IMStore.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('删除成功!')", true); return; } else if (e.CommandName == "SET") { Panel_areal.Visible = true; Panel_arealedit.Visible = true; GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_IMStore.SelectedIndex = row.RowIndex; GridView_IMStore.SelectedIndex = -1; Store_Name = row.Cells[1].Text.Trim().ToString(); string id = e.CommandArgument.ToString(); Guid guid_id = new Guid(id); areal_guid = guid_id; GridView_areal.DataSource = PSB.S_STOREareal(areal_guid); GridView_areal.DataBind(); UpdatePanel_areal.Update(); UpdatePanel_arealedit.Update(); } else if (e.CommandName == "SEE") { Panel_areal.Visible = true; GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; GridView_IMStore.SelectedIndex = row.RowIndex; GridView_IMStore.SelectedIndex = -1; Store_Name = row.Cells[1].Text.Trim().ToString(); string id = e.CommandArgument.ToString(); Guid guid_id = new Guid(id); areal_guid = guid_id; GridView_areal.DataSource = PSB.S_STOREareal(areal_guid); GridView_areal.DataBind(); GridView_areal.Columns[4].Visible = false; GridView_areal.Columns[5].Visible = false; UpdatePanel_areal.Update(); UpdatePanel_arealedit.Update(); } } //linkbutton链接按钮根据自身Commandname来触发不同事件