我有1个新建按钮
/新建按钮
        protected void btnNew_Click(object sender, EventArgs e)
        {
          
            Response.Redirect("ProductDetails.aspx?product=1"); }
和一个protected void GridShow_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //当鼠标停留时更改背景色
                e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#9CCBF7';this.style.cursor='hand'");
                //当鼠标移开时还原背景色
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
                //string strId = GridView1.DataKeys[e.Row.RowIndex].Value.ToString();
                e.Row.Attributes.Add("ondblclick", "window.open('ProductDetails.aspx?Product=2 CODE=" + GridShow.DataKeys[e.Row.RowIndex].Value + "')");
               }
            }
2个都跳转到 'ProductDetails.aspx 
那么我在'ProductDetails.aspx表的
 protected void Page_Load(object sender, EventArgs e)
        {
}里面怎么判断是那个跳过来的?

解决方案 »

  1.   

    判断product参数啊if(Request.QueryString["product"]=="1") 
    {
       //btnNew按钮点击过来的
    }
    else
    {
        //绑定链接点击过来的
    }另外你上面的参数product大小写最好一致,CODE参数前要加&,即...product=2&CODE=...
      

  2.   

    我是双击GridView详细跳转到这个页面的,我想让双击的详细信息显示到这个页面上  
    用一个方法 将这个详细信息都写到这个方法里面,然后在 else{
    里面去 调用哪个方法  
    }
    我双击跳转过来后 页面上会显示我的那些信息吗?
      

  3.   

    你在传一个ID嘛,去判断,如果没这个ID就直接跳走,如果有就用这个ID去查询详细信息(参数之间用 &  这个符号链接  ProductDetails.aspx?Product=2&CODE=" + GridShow.DataKeys[e.Row.RowIndex].Value + "')
    protected void GridShow_RowDataBound(object sender, GridViewRowEventArgs e)
    {
       e.Row.Attributes.Add("ondblclick", "window.open('ProductDetails.aspx?Product=2&CODE=" + GridShow.DataKeys[e.Row.RowIndex].Value + "')");

    你可以在ProductDetails.aspx页面去获取这个Product和CODE
    如果这里的CODE是ID那你就根据这个ID去查询就OK了