private void DeleteKeyWords(string SId) { B_DownServer bdownserver = new B_DownServer(); if (bdownserver.DeleteByID(SId)) { HttpContext.Current.Response.Write("<script language=javascript> alert('删除成功!');window.document.location.href='DownServerManage.aspx';</script>"); } }
private void InItModify(int Dsid) { B_DownServer bdownerver=new B_DownServer(); M_DownServer mdownserver =bdownerver.GetDownServerByid(Dsid); TxtServerName.Text = mdownserver.ServerName; TxtServerLogo.Text = mdownserver.ServerLogo; TxtServerUrl.Text = mdownserver.ServerUrl; DropShowType.SelectedValue = mdownserver.ShowType.ToString(); EBtnModify.Visible = true; EBtnSubmit.Visible = false; }
protected void EBtnSubmit_Click(object sender, EventArgs e) { B_DownServer bdownserver = new B_DownServer(); M_DownServer mdownserver = new M_DownServer(); mdownserver.ServerID = bdownserver.Max() + 1; mdownserver.ServerName = TxtServerName.Text.ToString(); mdownserver.ServerLogo = TxtServerLogo.Text.ToString(); mdownserver.ServerUrl = TxtServerUrl.Text.ToString(); mdownserver.ShowType = Convert.ToInt32(DropShowType.SelectedValue); if(bdownserver.Add(mdownserver)) { Response.Write("<script language=javascript> alert('添加成功!');window.document.location.href='DownServerManage.aspx';</script>"); //Page.Response.Redirect("DownServerManage.aspx"); } }
protected void btndelete_Click(object sender, EventArgs e) { B_DownServer bdownserver = new B_DownServer(); int i = 0, flag = 0; string sid = ""; //int f = GridView1.Rows.Count;//测试用OnClientClick="return confirm('确定要删除选中的服务器吗?')" for (i = 0; i < GridView1.Rows.Count; i++) { CheckBox cbox=(CheckBox)GridView1.Rows[i].Cells[0].FindControl("SelectCheckBox"); bool check = cbox.Checked; if (((CheckBox)GridView1.Rows[i].Cells[0].FindControl("SelectCheckBox")).Checked)//check { sid = GridView1.DataKeys[GridView1.Rows[i].RowIndex].Value.ToString(); if (bdownserver.DeleteByID(sid)) flag++; } } if (flag > 0) { Response.Write("<script language=javascript> alert('批量删除成功!');window.document.location.href='DownServerManage.aspx';</script>"); } }
public void MyBind() { B_DownServer bdownserver = new B_DownServer(); GridView1.DataSource = bdownserver.GetDownServerAll();// GetAuthorPage(0, 0, 10); GridView1.DataBind(); }