——此文章摘自《ASPNET +SQL Server网络应用系统开发案例精解》定价¥特价¥ 详细>> { ResponseRedirect(/Indexaspx); } } public void BindGrid() { string STNickName = Session[STNickName]ToString(); //创建查询指定连锁店产品信息的sql语句 STmysql = select STProDeIDSTProDeSTProdIDSTProDeSTProdName STProDeSTProdPrice STProDeSTProdBZSTProDeSTProdSHSTProDeSTProdInfo from STProDeSTUser where STProDeSTDepID = STUserSTDepID and STUserSTNickName = + STNickName + ; //创建SqlDataAdapter的实例 SqlDataAdapter STsda=new SqlDataAdapter(STmysqlSTconn); //创建DataSet的实例 DataSet STds=new DataSet(); //将信息填充到DataSet STsdaFill(STds); //将信息绑定到DataGrid STmyGridDataSource = STds; STmyGridDataBind(); } //处理分页 public void STmyGrid_Page(object senderDataGridPageChangedEventArgs e) { //获取DataGrid的当前显示页的索引 STmyGridCurrentPageIndex=eNewPageIndex; //重新显示数据 BindGrid(); } 单击编辑按钮弹出一个Window窗口用来编辑产品信息单击删除按钮直接删除指定ID的产品信息 public void dgItem(object source DataGridCommandEventArgs e) { //获取要编辑的ID号 int ID = intParse(eItemCells[]Text); //单击编辑按钮所触发的事件 if(eCommandName==edit) { //弹出用于编辑的窗口 ResponseWrite(<script language=javascript defer>ret = windowshowModalDialog(STAddProduct aspx?Action=edit&id=+ID+windowdialogHeight:px;dialogWidth:px;center:Yes;Help:No;Resizable:No;Scroll:auto;Status:no;);</script>); } [] [] [] |