Dim objItems As clsItems
'Loads the pages with the Gridview and Infomation pretaining to the Item selected
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim qryItemNum As String = Request.QueryString("qryItemNum")
'Populates Gridview
If Not Page.IsPostBack Then
gvwCategorySelect.DataSource = clsCategory.GetList
gvwCategorySelect.DataBind()
'imgbtnPrev.Visible = False
'If Not String.IsNullOrEmpty(qryItemNum) Then
' Dim ItemNum As Int32
' If Int32.TryParse(test, ItemNum) Then
' imgbtnPrev.Visible = (-1 < ItemNum)
' End If
'End If
End If
objItems = New clsItems(qryItemNum)
'Set up the from labels
lblTitle.Text = objItems.Title
lblPrice.Text = objItems.Price.ToString("C")
lblDescription.Text = objItems.Description
ImgItem.ImageUrl = "~/images/ItemImages/Item" & objItems.ItemNum & ".jpg"
End Sub
'Returns to pervious item
Protected Sub imgbtnPrev_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles imgbtnPrev.Click
Response.Redirect("~/ItemInfo.aspx?qryItemNum=" & objItems.ItemNum - 1)
End Sub
'Next item
Protected Sub imgbtnNext_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles imgbtnNext.Click
Response.Redirect("~/ItemInfo.aspx?qryItemNum=" & objItems.ItemNum + 1)
End Sub
在上面的代碼中有2個圖像按鈕,它們在不同的ItemNum之間移動。我試着從點擊後退按鈕停止用戶,通過移除imgbtnPrev按鈕時,在1我需要驗證在asp.net中的查詢字符串
錯誤信息的查詢字符串說,有在位置沒有行0
dataRowObject = DBMethods.CreateTable(sqlString, sqlArg).Rows(0)
^這裏是哪裏是其突出顯示。
[你有什麼嘗試?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – Joe 2013-03-01 20:09:35
這是什麼問題? – 2013-03-01 20:14:00
只需使用Request.QueryString獲取查詢字符串值即可。並做你想要的 – Sachin 2013-03-01 20:14:29