我想讓整個GridView行成爲一個鏈接,我想我知道了但我遇到了一個問題。正如你可以從下面看到的,我所有的查詢字符串數據都來自數據庫,現在我想添加一個不是來自數據庫的查詢字符串,我怎麼能做到這一點?在GridView中創建一整行鏈接?
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string Types = Request.QueryString["Type"].ToString();
string Rounds = Request.QueryString["Rounds"].ToString();
string Groups = Request.QueryString["Groups"].ToString();
string Id = DataBinder.Eval(e.Row.DataItem, "Id").ToString();
string League = DataBinder.Eval(e.Row.DataItem, "League").ToString();
string Team1 = DataBinder.Eval(e.Row.DataItem, "Team1").ToString();
string Team2 = DataBinder.Eval(e.Row.DataItem, "Team2").ToString();
string Type = DataBinder.Eval(e.Row.DataItem, "TType").ToString();
string Location = ResolveUrl("Update_Match.aspx" + "?Id=" + Id + "&Team1=" + Team1 + "&Team2=" + Team2 + "&League=" + League + "&Type=" + Type + "&Types=" + Types + "&Rounds=" + Rounds + "&Groups=" + Groups);
e.Row.Attributes["onClick"] = string.Format("javascript:window.location='{0}';", Location);
e.Row.Style["cursor"] = "pointer";
}
}
它從哪裏來? –
只是澄清......這聽起來像你回答了標題中提出的問題,你實際上是問如何混淆查詢字符串呢?如果是這樣,您可能需要更改標題。 – nycdan
@詹姆斯,這是我想要在鏈接中進行硬編碼的東西。它不是來自數據庫,例如Id和League來自表格字段,Type,Rounds和Groups正從前一頁的QueryString中拉出。 – jorame