473,395 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

using data from one to page to another

hello,

I have pasted my code below. My issue is that I want the use to select an
author from the drop down list and upon doing so i should navigate to
another page and pull the full record. Any ideas?

************************************************** *********************
<%@ Page Language ="VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Public ReadOnly Property selectedText As String
Get
Return ddl.selecteditem.Text
End Get
End Property
sub page_load(sender as Object, e As EventArgs)
If Not Page.IsPostBack Then
getdata()
end if
end sub

sub getdata()
Dim myconnection as SqlConnection = new
sqlconnection("server=servera;uid=app;pwd=password ;database=pubs")
Dim mycommand as SqlCommand = new SqlCommand("Select au_id, au_lname,
au_fname from Authors",myconnection)
Dim MyDatareader as SqlDataReader

myconnection.open()
mydatareader=myCommand.ExecuteReader()
ddl.DataSource = MyDataReader
ddl.DataBind()
MyDataReader.Close()
ddl.Items.Insert(0,"Select an Item")
ddl.SelectedIndex = 0
myconnection.close()
End Sub

Sub displayselection(sender as Object, e as EventArgs)
lblSelection.Text = "You selected the item in position " _
& ddl.SelectedItem.Value _
& " which corresponds to the name " _
& ddl.SelectedItem.Text _
& "."
End Sub

</script>

<html>
<body>
<form runat="server">
<asp:DropDownList id="ddl" runat="server" DataTextField="au_lname"
DataValueField="au_id" />
<br>
<br>
<asp:Button id="Button1" runat="server" OnClick="displayselection"
text="Submit" />
</form>
<p>
<asp:Label id="lblSelection" runat="server" />
</p>

</body>
</html>
Nov 17 '05 #1
1 885
Try this?

http://authors.aspalliance.com/kenc/passval.aspx
"mike" <mi**@telus.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
hello,

I have pasted my code below. My issue is that I want the use to select an
author from the drop down list and upon doing so i should navigate to
another page and pull the full record. Any ideas?

************************************************** *********************
<%@ Page Language ="VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Public ReadOnly Property selectedText As String
Get
Return ddl.selecteditem.Text
End Get
End Property
sub page_load(sender as Object, e As EventArgs)
If Not Page.IsPostBack Then
getdata()
end if
end sub

sub getdata()
Dim myconnection as SqlConnection = new
sqlconnection("server=servera;uid=app;pwd=password ;database=pubs")
Dim mycommand as SqlCommand = new SqlCommand("Select au_id, au_lname,
au_fname from Authors",myconnection)
Dim MyDatareader as SqlDataReader

myconnection.open()
mydatareader=myCommand.ExecuteReader()
ddl.DataSource = MyDataReader
ddl.DataBind()
MyDataReader.Close()
ddl.Items.Insert(0,"Select an Item")
ddl.SelectedIndex = 0
myconnection.close()
End Sub

Sub displayselection(sender as Object, e as EventArgs)
lblSelection.Text = "You selected the item in position " _
& ddl.SelectedItem.Value _
& " which corresponds to the name " _
& ddl.SelectedItem.Text _
& "."
End Sub

</script>

<html>
<body>
<form runat="server">
<asp:DropDownList id="ddl" runat="server" DataTextField="au_lname"
DataValueField="au_id" />
<br>
<br>
<asp:Button id="Button1" runat="server" OnClick="displayselection"
text="Submit" />
</form>
<p>
<asp:Label id="lblSelection" runat="server" />
</p>

</body>
</html>

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
4
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
1
by: jmdolinger | last post by:
Hi all, I'm a newbie to Atlas (and recently ASP.NET) after coming from a long Java background, also have done quite a bit with an Ajax.NET/ASP.NET 1.1 project, but it was basically all...
13
by: trpost | last post by:
I am looking for a way to send data from one page to another as POST data without using forms or cURL. I have a php script that is passing a list of cases from on page to another when a link is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.