No 32 · 实现双击表格行超级链接到另一页并传递参数

来源:互联网 发布:数据库的开发 编辑:程序博客网 时间:2024/05/18 19:45
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)    {        //如果当前项不为空        if (e.Row.RowIndex != -1)        {            //取得当前项的索引值加1,因为项的索引值是从0开始的            int orderID = e.Row.RowIndex + 1;            e.Row.Cells[0].Text = orderID.ToString();        }        {            //点击表格打开            if (e.Row.RowType == DataControlRowType.DataRow)            {                string url = Server.UrlEncode(e.Row.Cells[1].Text.ToString());                e.Row.Attributes.Add("ondblclick", "location.href='Default2.aspx?title=" + url + "'");                          }        }    }

原创粉丝点击