How do I pass a NavigateURL result to another web form

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>
'----------------------------------------------
 
Joined
Sep 4, 2008
Messages
1
Reaction score
0
Helped me out a load. now have asp:label working with navigateurl compiled from static data and parsed data from database.

thanks a lot
Jonathan
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top