这是我的vb.net代码 -
在子程序中我有 -
Private Sub xxx()
Sqlstr = "SELECT * FROM table"
ExecuteNonQuery(Sqlstr)
SqlCmd = New SqlCommand(Sqlstr, SqlCnn)
SqlDR = SqlCmd.ExecuteReader
If SqlDR.HasRows Then
Do While SqlDR.Read()
r = New TableRow
Dim l As New LinkButton
l.Text = SqlDR("column_name")
l.Attributes.Add("onClick", "setAction(" + CStr(SqlDR("id")) + ",'edit')")
l.ID = SqlDR("id")
c = New TableCell
c.Controls.Add(l)
r.Cells.Add(c)
....
所以当这个人点击我在这里提供的超链接时,我转到page_load并执行此操作
If (Me.pageAction.Value = "edit") Then
Response.Redirect("next.aspx?id=" ???? - i dont know what to put here.
End If
我希望next.aspx页面具有被点击的编辑值(所以ID值)
我是做正确的事还是有人有更好的解决方案,更简单,更清洁?
答案 0 :(得分:0)
Response.Redirect("next.aspx?Field=Value&AnotherField=AnotherValue")
要在下一页中找回它:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim field As String = Request.QueryString("Field")
Dim anotherField As String = Request.QueryString("AnotherField")
End Sub
您可能需要查看this article了解更多详情。