假设我有网址www.abc.com/orders.aspx?order_id=4321
。所以在这个页面中有一个textbox
加载它应该从url获取值,其中id = 4321。
所以我尝试了这段代码,但它没有用。请帮忙
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Request.QueryString.HasKeys Then
Dim user As String = Request.QueryString(0).ToString
trackInput.Text = user
End If
End Sub
答案 0 :(得分:0)
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Request.QueryString.HasKeys Then
Dim user As String = Request.QueryString(order_id).ToString()
trackInput.Text = user
End If
End Sub
试试这个..
将ToString更改为ToString()