如果我的理解是正確的,你只是想顯示作爲查詢字符串到新頁面傳遞的文本,如果這是正確的,只是閱讀查詢字符串,並在標籤中顯示。
爲了達到此目的,您需要在網格內的鏈接中指定查詢字符串,您的鏈接必須看起來像這樣;
~/Abstract.aspx?d=your+text
在你的DataGrid:
<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink
NavigateUrl='<%# "~/Abstract.aspx?d=" + HttpUtility.UrlEncode(DataBinder.Eval(Container, "DataItem.Id").ToString()) %>'
runat="server"
Text="Product" />
</ItemTemplate>
</asp:TemplateColumn>
在你有類似的目標頁面:
string text = string.Empty;
if (this.Request.QueryString["d"] == null)
text = "Not found";
else
text = Server.UrlDecode(this.Request.QueryString["d"]);
// encode the text to avoid XSS (cross-site scripting)
this.myLabel.Text = Server.HtmlEncode(text);
+1例如。日Thnx。 – Jeremy
感謝您的好帖子,但我不知道我明白,因爲我無法讓它工作。 –