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 之间移动。我试图通过在查询字符串为 1 时删除 imgbtnPrev 按钮来阻止用户单击上一个按钮。
错误消息显示位置 0 处没有行
dataRowObject = DBMethods.CreateTable(sqlString, sqlArg).Rows(0)
^ 这里是突出显示的地方。