using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;public partial class MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { } public string getpath(object o) { return "~/Default.aspx?depid=" + o.ToString(); } }
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using My.Model;
using My.BLL;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.GridView1.DataSource = BLLperson.GetAllperson();
this.GridView1.DataBind();
}
if (Request.QueryString["depid"] != null)
{
this.Label5.Text = Request.QueryString["depid"].ToString();
this.GridView1.DataSource = BLLperson.GetAllpersonBydepid(Int32.Parse(this.Label5.Text.ToString()));
this.GridView1.DataBind();
}
}
public string getpath(object o)
{
return "~/Default2.aspx?id=" + o.ToString();
} protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{ }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "del")
{
BLLperson.delete(Int32.Parse(e.CommandArgument.ToString()));
}
this.GridView1.DataBind();
} protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton l = e.Row.FindControl("LinkButton2") as LinkButton;
l.Attributes.Add("onclick", "return confirm('是否删除?')");
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#fffccc'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
}
}
这是子页面的
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{ } public string getpath(object o)
{
return "~/Default.aspx?depid=" + o.ToString();
}
}
这是母版页