I've put together a page that lists items in a data grid. I've set it up so that when a user clicks the item description, it loads up a panel below the list with the details for that item. I've got this part working, but would like to make the page scroll down to the top of the details section when it reloads. I've inserted a bookmark (a name="Details") at the beginning of the Details section, but can't figure out how to make the page jump to this bookmark once it reloads.
Here's the code I'm using:
Here's the code I'm using:
Code:
<ItemTemplate>
<asp:LinkButton id="ItemDetailsLink"
onCommand="ItemDetailsLink_Command"
CommandName="ItemID"
CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.ID").ToString %>' runat="server">
<%# Container.DataItem("Description") %>
</asp:LinkButton>
</ItemTemplate>
Code:
sub ItemDetailsLink_Command(sender as Object, e as CommandEventArgs)
pnlItemDetails.visible="true"
ShowDetails(e.CommandArgument)
End Sub
Sub ShowDetails(ItemID as String)
dim dbconn,sql,dbcomm,dbread,i
' Show the Item details
dbconn=New OleDbConnection(Application("ConnectionString"))
dbconn.Open()
sql="SELECT * FROM Orders
WHERE Opportunity = '" & Httpcontext.Current.Request.Querystring("ID") & "'
AND ID = " & ItemID & " ORDER BY OrderID"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
ItemDetails.DataSource = dbread
ItemDetails.DataBind()
dbread.Close()
dbconn.Close()
End Sub
Last edited: