急急急..在线等......asp.net中的事件问题?
//第一个GridView事件
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA';this.style.cursor='hand'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
//获取部门代码编号以便传入Bmwh_AddBm.aspx页面进行更新
string xmmc = (e.Row.FindControl("Label1") as Label).Text;
//双击GridView某一行进行修改事件 ?ID=" & gid & "'根据要修改的编号对应信息传入Bmwh_AddBm.aspx部门添加和更新所属的同一页面,根据是否传入值进行判断是否是添加还是更新
e.Row.Attributes.Add("ondblclick", "window.location='../../RSGL/RSZL/Rsgl_Zdyxm.aspx?mc=" + xmmc + "'");
}
}
catch
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('程序有误!');</script>");
}
}
//第二个GridView事件
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA';this.style.cursor='hand'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
//获取部门代码编号以便传入Bmwh_AddBm.aspx页面进行更新
string xmmc = (e.Row.FindControl("Label1") as Label).Text;
//双击GridView某一行进行修改事件 ?ID=" & gid & "'根据要修改的编号对应信息传入Bmwh_AddBm.aspx部门添加和更新所属的同一页面,根据是否传入值进行判断是否是添加还是更新
e.Row.Attributes.Add("ondblclick", "window.location='../../RSGL/RSZL/Rsgl_Zdyxm.aspx?mc=" + xmmc + "'");
}
}
catch
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('程序有误!');</script>");
}
}
正常情况下,是执行了GridView1,紧接着执行GridView2.但是我现在要实现,执行GridView就不执行GridView2,执行GridView2就不执行GridView1.要怎么判断?我一开始在load事件里写了一个判断,但不知道GridView_RowDataBound(?,?)里面的两个参数写什么?
请各位高手指教啊......先谢谢大家了