protected void Btn_StoreSearch_Click(object sender, EventArgs e)//检索,出入库 { if ((DropDownList_StoreIn.Text.Trim().ToString()) == "出入库类别") { IN = "入库类别"; OUT = "出库类别"; GridView_IMSSBD.DataSource = PSB.SList_IMssd_in_out(IN.ToString(), OUT.ToString()); GridView_IMSSBD.DataBind(); UpdatePanel_IMSSBD.Update(); } else if ((DropDownList_StoreIn.Text.Trim().ToString()) == "入库类别") { IN = "入库类别"; OUT = "空"; GridView_IMSSBD.DataSource = PSB.SList_IMssd_in_out(IN.ToString(), OUT.ToString()); GridView_IMSSBD.DataBind(); UpdatePanel_IMSSBD.Update(); } else if ((DropDownList_StoreIn.Text.Trim().ToString()) == "出库类别") { IN = "空"; OUT = "出库类别"; GridView_IMSSBD.DataSource = PSB.SList_IMssd_in_out(IN.ToString(), OUT.ToString()); GridView_IMSSBD.DataBind(); UpdatePanel_IMSSBD.Update(); } }
protected void Btn_NewOut_Click(object sender, EventArgs e)//新增出库 { imssdinfo.IMSSBD_Man = Session["UserName"].ToString(); imssdinfo.IMSSBD_Name = TextBox_OutName.Text.Trim().ToString(); imssdinfo.IMSSBD_Detail = TextBox_OutDetail.Text.Trim().ToString(); imssdinfo.IMSSBD_Time = DateTime.Now; if (TextBox_OutName.Text.Trim().ToString() != "") { DataSet ds = PSB.SList_IMssd_Name(TextBox_OutName.Text.Trim().ToString()); 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 { PSB.I_IMssdOut(imssdinfo); GridView_IMSSBD.DataSource = PSB.SList_IMssd_in_out(IN.ToString(), OUT.ToString()); GridView_IMSSBD.DataBind(); UpdatePanel_IMSSBD.Update(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('类型新增成功!')", true); return; } } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('类型名称不能为空!')", true); return; } }
} //linkbutton链接按钮根据自身Commandname来触发不同事件 protected void GridView_IMSSBD_RowEditing(object sender, GridViewEditEventArgs e) { //激活编辑按钮的事件 GridView_IMSSBD.EditIndex = e.NewEditIndex; GridView_IMSSBD.Columns[6].Visible = true; GridView_IMSSBD.DataSource = PSB.SList_IMssd_in_out(IN.ToString(), OUT.ToString()); GridView_IMSSBD.DataBind(); UpdatePanel_IMSSBD.Update(); } //编辑//当为commandField时使用这种,为模板列连接按钮使用rowcommand根据command那么不同来操作
protected void Button_StoreCancel_Click(object sender, EventArgs e)//重置检索 { DropDownList_StoreIn.Text = "出入库"; IN = "入库类别"; OUT = "出库类别"; GridView_IMSSBD.DataSource = PSB.SList_IMssd_in_out(IN.ToString(), OUT.ToString()); GridView_IMSSBD.DataBind(); UpdatePanel_IMSSBD.Update(); }
}//databind ,用于调整格式 protected void GridView_IMSSBD_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_IMSSBD.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_IMSSBD.PageCount ? GridView_IMSSBD.PageCount - 1 : newPageIndex; // specify the NewPageIndex GridView_IMSSBD.PageIndex = newPageIndex; GridView_IMSSBD.PageIndex = newPageIndex; GridView_IMSSBD.DataSource = PSB.SList_IMssd_in_out(IN.ToString(), OUT.ToString()); GridView_IMSSBD.DataBind(); UpdatePanel_IMSSBD.Update(); } //读取go前textbox,导航到指定页面