如何在asp.net中使用查詢字符串。asp.net中的查詢字符串
5
A
回答
7
這取決於究竟query.string你指的是語言做了,但是......
Request.QueryString["MyValue"];
http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx
2
Request.QueryString["StringValue"];
2
0
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>asp.net QueryString example: how to use QueryString</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy">QueryString Example</h2>
<asp:HyperLink
ID="HyperLink1"
runat="server"
NavigateUrl="~/Image.aspx?ImageID=1&ImageName=Elephant"
Text="Test QueryString"
>
</asp:HyperLink>
</div>
</form>
你也可以使用按鈕單擊事件,而不是頁面加載。
protected void Page_Load(object sender, System.EventArgs e) {
string ID = Request.QueryString["ImageID"];
string Name = Request.QueryString["ImageName"];
Label1.Text = "ImageID: "+ ID;
Label2.Text = "Image name: "+ Name;
Image1.ImageUrl = "~/Images/"+Name+".jpg";
}
相關問題
- 1. Asp.Net查詢字符串
- 2. ASP.NET查詢字符串
- 3. ASP.NET查詢子字符串
- 4. 從asp.net中刪除查詢字符串
- 5. 查詢字符串的ASP.NET URL重寫
- 6. ASP.Net查詢字符串超時
- 7. ASP.NET MVC:URL路由與查詢字符串
- 8. Url用ASP.NET查詢字符串重寫
- 9. ASP.NET System.Web.Routing和查詢字符串參數
- 10. ASP.NET MVC - 重寫FormMethod.Get查詢字符串?
- 11. asp.net查詢字符串數據綁定
- 12. 查詢字符串在asp.net MVC 2
- 13. ASP.NET查詢字符串第二個值
- 14. ASP.NET MVC路由和查詢字符串
- 15. ASP.NET查詢字符串沒有等號
- 16. 查詢字符串
- 17. 查詢字符串
- 18. 使用查詢字符串查詢字符串列表?
- 19. 爲什麼我的ASP.NET MVC路由中的查詢字符串?
- 20. Python的查詢(字符串)
- 21. servlet的查詢字符串
- 22. jQuery的查詢字符串
- 23. 動態linq查詢由於asp.net mvc中的查詢字符串c#
- 24. 我需要驗證在asp.net中的查詢字符串
- 25. 在asp.net中需要關於查詢字符串的幫助
- 26. 如何刪除查詢字符串中的空參數asp.net mvc
- 27. 如何在asp.net中保護/加密你的查詢字符串?
- 28. 如何處理asp.net web api中的查詢字符串參數
- 29. 在ASP.NET中使用查詢字符串的最佳做法?
- 30. 如何訪問asp.net mvc中的查詢字符串參數?