How do I pass a NavigateURL result to another web form

  • Thread starter Thread starter timmso
  • Start date Start date
T

timmso

I've got a web form working with a repeater, using code below. My goal is to
generate a list of hyperlinks that, once clicked, take me to another page
with related information that was clicked.

If I hover over the link, I can see that the correct title's ID is there.
Now how do I "pass" the result to another page (with that ID).

So let's say that I have 3 items generated from the code below:

Title_1
Title_B
Title_Z

When I click on Title_B, I want to redirect to a web form that contain that
title's Code. So if Title_B's CodeID is 2 (which I can see by hovering over
it with the mouse), I would imagine I would want some SQL like (this is how
I would select it in Access):

SELECT tblCode.Code, tblCode.CodeID FROM tblCode WHERE
(((tblCode.CodeID)=2));

How do I do this with Asp.Net by "linking" the web forms?

'--------------------------------------------------------
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.OleDb" %>
<%@ Page debug="true" %>
<html>
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<asp:HyperLink id="HyperLink1" runat="server"
NavigateUrl='<%#"http://localhost/ngrid1/repeater.aspx?a=" &
Container.DataItem("CodeID")%>'>'<%# DataBinder.Eval(Container.DataItem,
"Title")%>'</asp:HyperLink>
<br>
</ItemTemplate>
</asp:Repeater>
</html>
<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
Dim strConnection As String = "Provider=Microsoft.Jet.OleDb.4.0;" & _
"data source=D:\Data\Codelib\codelib.mdb;"
Dim objConnection As New OleDbConnection(strConnection)
Dim strSQL As String = "SELECT CodeID, Title from tblCode;"
Dim objCommand As New OleDbCommand(strSQL, objConnection)
objConnection.Open()
Repeater1.DataSource = objCommand.ExecuteReader()
Repeater1.DataBind()
objConnection.Close()
End Sub
</script>
'----------------------------------------------
 
Back
Top