Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Display User Selection From Combo Box

Reply
Thread Tools

Display User Selection From Combo Box

 
 
rikesh
Guest
Posts: n/a
 
      02-06-2004
Hi

I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.

Kind regards

--
Kind Regards

Rikesh
(V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)



<%

Dim objConnection 'The connection object
Dim objRecordset 'The recordset object

' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"

' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")

' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"

' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection

Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))

%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close

' clean the Recordset object
Set objRecordset = Nothing
%>



 
Reply With Quote
 
 
 
 
Alex Goodey
Guest
Posts: n/a
 
      02-06-2004
Do you want to the selection to be displayed on the same page as the form?
or after the fgorm has been submitted?

if it's the first then it is a client side issue and you will have a better
response from a client side or javascript newsgroup


"rikesh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I'm sure this is a very trivial problem!
> I have a combo bound to a recordset. I was wondering how I can show the
> value on the page, what the user has selected?
> The code that I'm using is below.
> Any help, would be much apprceciated.
>
> Kind regards
>
> --
> Kind Regards
>
> Rikesh
> (V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)
>
>
>
> <%
>
> Dim objConnection 'The connection object
> Dim objRecordset 'The recordset object
>
> ' create the Connection object
> Set objConnection = Server.CreateObject("ADODB.Connection")
> ' open the DSN
> objConnection.Open "Provider=sqloledb;" & _
> "Data Source=DEVSVR;" & _
> "Initial Catalog=pubs;" & _
> "User Id=sa;" & _
> "Password=admin"
>
> ' creates the recordset object
> Set objRecordset = Server.CreateObject("ADODB.Recordset")
>
> ' SQL String for query
> Dim strSQL
> strSQL = "SELECT au_id, au_lname FROM Authors"
>
> ' execute the SQL statement that you want
> ' The query should return all the data you'll
> ' need in your combo box
> objRecordset.Open strSQL, objConnection
>
> Request.Form("au_lname")
> Response.Write (Request.Form("au_lname"))
>
> %>
> <HTML>
> <BODY>
> <FORM ACTION="DBCombo.asp" METHOD=POST>
> <select name=cboPrimary size=1 >
> <!--onChange="frmTest.submit();"> -->
> Choose from the combo:
> select name="lstTopic" size="1">
> <%
> ' while we don't get the end of DataBase
> Do While Not objRecordset.EOF
> 'we put the ID at Value
> 'this value is important to linked tables
> %>
> <option VALUE="<%=objRecordset("au_ID")%>">
> <!-- This is what will appear in the combo box -->
> <%=objRecordset("au_lname")%>
> </option>
> <%
> ' Move to the next record...
> objRecordset.MoveNext
> Loop ' keep the loop
> %>
> </SELECT>
> </FORM>
> </BODY>
> </HTML>
> <%
> ' close the recordset object
> objRecordset.Close
>
> ' clean the Recordset object
> Set objRecordset = Nothing
> %>
>
>
>



 
Reply With Quote
 
 
 
 
rikesh
Guest
Posts: n/a
 
      02-06-2004
Yeah, I would prefer on the same page!
So does that it's a client issue?

"Alex Goodey" <(E-Mail Removed)> wrote in message
news:bvvp7o$1143cs$(E-Mail Removed)-berlin.de...
> Do you want to the selection to be displayed on the same page as the form?
> or after the fgorm has been submitted?
>
> if it's the first then it is a client side issue and you will have a

better
> response from a client side or javascript newsgroup
>
>
> "rikesh" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi
> >
> > I'm sure this is a very trivial problem!
> > I have a combo bound to a recordset. I was wondering how I can show the
> > value on the page, what the user has selected?
> > The code that I'm using is below.
> > Any help, would be much apprceciated.
> >
> > Kind regards
> >
> > --
> > Kind Regards
> >
> > Rikesh
> > (V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)
> >
> >
> >
> > <%
> >
> > Dim objConnection 'The connection object
> > Dim objRecordset 'The recordset object
> >
> > ' create the Connection object
> > Set objConnection = Server.CreateObject("ADODB.Connection")
> > ' open the DSN
> > objConnection.Open "Provider=sqloledb;" & _
> > "Data Source=DEVSVR;" & _
> > "Initial Catalog=pubs;" & _
> > "User Id=sa;" & _
> > "Password=admin"
> >
> > ' creates the recordset object
> > Set objRecordset = Server.CreateObject("ADODB.Recordset")
> >
> > ' SQL String for query
> > Dim strSQL
> > strSQL = "SELECT au_id, au_lname FROM Authors"
> >
> > ' execute the SQL statement that you want
> > ' The query should return all the data you'll
> > ' need in your combo box
> > objRecordset.Open strSQL, objConnection
> >
> > Request.Form("au_lname")
> > Response.Write (Request.Form("au_lname"))
> >
> > %>
> > <HTML>
> > <BODY>
> > <FORM ACTION="DBCombo.asp" METHOD=POST>
> > <select name=cboPrimary size=1 >
> > <!--onChange="frmTest.submit();"> -->
> > Choose from the combo:
> > select name="lstTopic" size="1">
> > <%
> > ' while we don't get the end of DataBase
> > Do While Not objRecordset.EOF
> > 'we put the ID at Value
> > 'this value is important to linked tables
> > %>
> > <option VALUE="<%=objRecordset("au_ID")%>">
> > <!-- This is what will appear in the combo box -->
> > <%=objRecordset("au_lname")%>
> > </option>
> > <%
> > ' Move to the next record...
> > objRecordset.MoveNext
> > Loop ' keep the loop
> > %>
> > </SELECT>
> > </FORM>
> > </BODY>
> > </HTML>
> > <%
> > ' close the recordset object
> > objRecordset.Close
> >
> > ' clean the Recordset object
> > Set objRecordset = Nothing
> > %>
> >
> >
> >

>
>



 
Reply With Quote
 
Alex Goodey
Guest
Posts: n/a
 
      02-06-2004
yep, do a search on google and you will probably find what you are looking
for.

it will be something to do with the onChange event of the drop down, or
something like that

"rikesh" <(E-Mail Removed)> wrote in message
news:u$(E-Mail Removed)...
> Yeah, I would prefer on the same page!
> So does that it's a client issue?
>
> "Alex Goodey" <(E-Mail Removed)> wrote in message
> news:bvvp7o$1143cs$(E-Mail Removed)-berlin.de...
> > Do you want to the selection to be displayed on the same page as the

form?
> > or after the fgorm has been submitted?
> >
> > if it's the first then it is a client side issue and you will have a

> better
> > response from a client side or javascript newsgroup
> >
> >
> > "rikesh" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi
> > >
> > > I'm sure this is a very trivial problem!
> > > I have a combo bound to a recordset. I was wondering how I can show

the
> > > value on the page, what the user has selected?
> > > The code that I'm using is below.
> > > Any help, would be much apprceciated.
> > >
> > > Kind regards
> > >
> > > --
> > > Kind Regards
> > >
> > > Rikesh
> > > (V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)
> > >
> > >
> > >
> > > <%
> > >
> > > Dim objConnection 'The connection object
> > > Dim objRecordset 'The recordset object
> > >
> > > ' create the Connection object
> > > Set objConnection = Server.CreateObject("ADODB.Connection")
> > > ' open the DSN
> > > objConnection.Open "Provider=sqloledb;" & _
> > > "Data Source=DEVSVR;" & _
> > > "Initial Catalog=pubs;" & _
> > > "User Id=sa;" & _
> > > "Password=admin"
> > >
> > > ' creates the recordset object
> > > Set objRecordset = Server.CreateObject("ADODB.Recordset")
> > >
> > > ' SQL String for query
> > > Dim strSQL
> > > strSQL = "SELECT au_id, au_lname FROM Authors"
> > >
> > > ' execute the SQL statement that you want
> > > ' The query should return all the data you'll
> > > ' need in your combo box
> > > objRecordset.Open strSQL, objConnection
> > >
> > > Request.Form("au_lname")
> > > Response.Write (Request.Form("au_lname"))
> > >
> > > %>
> > > <HTML>
> > > <BODY>
> > > <FORM ACTION="DBCombo.asp" METHOD=POST>
> > > <select name=cboPrimary size=1 >
> > > <!--onChange="frmTest.submit();"> -->
> > > Choose from the combo:
> > > select name="lstTopic" size="1">
> > > <%
> > > ' while we don't get the end of DataBase
> > > Do While Not objRecordset.EOF
> > > 'we put the ID at Value
> > > 'this value is important to linked tables
> > > %>
> > > <option VALUE="<%=objRecordset("au_ID")%>">
> > > <!-- This is what will appear in the combo box -->
> > > <%=objRecordset("au_lname")%>
> > > </option>
> > > <%
> > > ' Move to the next record...
> > > objRecordset.MoveNext
> > > Loop ' keep the loop
> > > %>
> > > </SELECT>
> > > </FORM>
> > > </BODY>
> > > </HTML>
> > > <%
> > > ' close the recordset object
> > > objRecordset.Close
> > >
> > > ' clean the Recordset object
> > > Set objRecordset = Nothing
> > > %>
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
掏團熱
Guest
Posts: n/a
 
      02-06-2004

"rikesh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I'm sure this is a very trivial problem!
> I have a combo bound to a recordset. I was wondering how I can show the
> value on the page, what the user has selected?
> The code that I'm using is below.
> Any help, would be much apprceciated.
>
> Kind regards
>
> --
> Kind Regards
>
> Rikesh
> (V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)
>
>
>
> <%
>
> Dim objConnection 'The connection object
> Dim objRecordset 'The recordset object
>
> ' create the Connection object
> Set objConnection = Server.CreateObject("ADODB.Connection")
> ' open the DSN
> objConnection.Open "Provider=sqloledb;" & _
> "Data Source=DEVSVR;" & _
> "Initial Catalog=pubs;" & _
> "User Id=sa;" & _
> "Password=admin"
>
> ' creates the recordset object
> Set objRecordset = Server.CreateObject("ADODB.Recordset")
>
> ' SQL String for query
> Dim strSQL
> strSQL = "SELECT au_id, au_lname FROM Authors"
>
> ' execute the SQL statement that you want
> ' The query should return all the data you'll
> ' need in your combo box
> objRecordset.Open strSQL, objConnection
>
> Request.Form("au_lname")
> Response.Write (Request.Form("au_lname"))
>
> %>
> <HTML>
> <BODY>
> <FORM ACTION="DBCombo.asp" METHOD=POST>
> <select name=cboPrimary size=1 >
> <!--onChange="frmTest.submit();"> -->
> Choose from the combo:
> select name="lstTopic" size="1">
> <%
> ' while we don't get the end of DataBase
> Do While Not objRecordset.EOF
> 'we put the ID at Value
> 'this value is important to linked tables
> %>
> <option VALUE="<%=objRecordset("au_ID")%>">
> <!-- This is what will appear in the combo box -->
> <%=objRecordset("au_lname")%>
> </option>
> <%
> ' Move to the next record...
> objRecordset.MoveNext
> Loop ' keep the loop
> %>
> </SELECT>
> </FORM>
> </BODY>
> </HTML>
> <%
> ' close the recordset object
> objRecordset.Close
>
> ' clean the Recordset object
> Set objRecordset = Nothing
> %>
>



<script language="javascript">
<!--
function ChangeSelect(which)
{
var wOne = which

document.sel.chgsel.value = wOne;
}
//-->
</script>
</HEAD>

<form name="sel">
<select name="lect" OnChange="ChangeSelect(this.value);">
<option value="111">111</option>
<option value="222">222</option>
<option value="333">333</option>
<option value="444">444</option>
<option value="555">555</option>
</select>
<br><br>
<input type="text" name="chgsel" size="20">
</form>


MSN : http://www.velocityreviews.com/forums/(E-Mail Removed)
email : (E-Mail Removed)
http://www.ubizcom.co.kr
---------------------------------------------- From DevSonner

 
Reply With Quote
 
rikesh
Guest
Posts: n/a
 
      02-06-2004
Cheers that works really well, by the way, a quick question, can one use
javascript and VBScript on the same page???


"掏團熱" <(E-Mail Removed)> wrote in message
news:c003pl$st1$(E-Mail Removed)...
>
> "rikesh" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi
> >
> > I'm sure this is a very trivial problem!
> > I have a combo bound to a recordset. I was wondering how I can show the
> > value on the page, what the user has selected?
> > The code that I'm using is below.
> > Any help, would be much apprceciated.
> >
> > Kind regards
> >
> > --
> > Kind Regards
> >
> > Rikesh
> > (V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)
> >
> >
> >
> > <%
> >
> > Dim objConnection 'The connection object
> > Dim objRecordset 'The recordset object
> >
> > ' create the Connection object
> > Set objConnection = Server.CreateObject("ADODB.Connection")
> > ' open the DSN
> > objConnection.Open "Provider=sqloledb;" & _
> > "Data Source=DEVSVR;" & _
> > "Initial Catalog=pubs;" & _
> > "User Id=sa;" & _
> > "Password=admin"
> >
> > ' creates the recordset object
> > Set objRecordset = Server.CreateObject("ADODB.Recordset")
> >
> > ' SQL String for query
> > Dim strSQL
> > strSQL = "SELECT au_id, au_lname FROM Authors"
> >
> > ' execute the SQL statement that you want
> > ' The query should return all the data you'll
> > ' need in your combo box
> > objRecordset.Open strSQL, objConnection
> >
> > Request.Form("au_lname")
> > Response.Write (Request.Form("au_lname"))
> >
> > %>
> > <HTML>
> > <BODY>
> > <FORM ACTION="DBCombo.asp" METHOD=POST>
> > <select name=cboPrimary size=1 >
> > <!--onChange="frmTest.submit();"> -->
> > Choose from the combo:
> > select name="lstTopic" size="1">
> > <%
> > ' while we don't get the end of DataBase
> > Do While Not objRecordset.EOF
> > 'we put the ID at Value
> > 'this value is important to linked tables
> > %>
> > <option VALUE="<%=objRecordset("au_ID")%>">
> > <!-- This is what will appear in the combo box -->
> > <%=objRecordset("au_lname")%>
> > </option>
> > <%
> > ' Move to the next record...
> > objRecordset.MoveNext
> > Loop ' keep the loop
> > %>
> > </SELECT>
> > </FORM>
> > </BODY>
> > </HTML>
> > <%
> > ' close the recordset object
> > objRecordset.Close
> >
> > ' clean the Recordset object
> > Set objRecordset = Nothing
> > %>
> >

>
>
> <script language="javascript">
> <!--
> function ChangeSelect(which)
> {
> var wOne = which
>
> document.sel.chgsel.value = wOne;
> }
> //-->
> </script>
> </HEAD>
>
> <form name="sel">
> <select name="lect" OnChange="ChangeSelect(this.value);">
> <option value="111">111</option>
> <option value="222">222</option>
> <option value="333">333</option>
> <option value="444">444</option>
> <option value="555">555</option>
> </select>
> <br><br>
> <input type="text" name="chgsel" size="20">
> </form>
>
>
> MSN : (E-Mail Removed)
> email : (E-Mail Removed)
> http://www.ubizcom.co.kr
> ---------------------------------------------- From DevSonner
>



 
Reply With Quote
 
DevSonner
Guest
Posts: n/a
 
      02-06-2004
<script language="javascript">

<script language="vbscript">
??


"rikesh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Cheers that works really well, by the way, a quick question, can one use
> javascript and VBScript on the same page???
>
>
> "掏團熱" <(E-Mail Removed)> wrote in message
> news:c003pl$st1$(E-Mail Removed)...
> >
> > "rikesh" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi
> > >
> > > I'm sure this is a very trivial problem!
> > > I have a combo bound to a recordset. I was wondering how I can show

the
> > > value on the page, what the user has selected?
> > > The code that I'm using is below.
> > > Any help, would be much apprceciated.
> > >
> > > Kind regards
> > >
> > > --
> > > Kind Regards
> > >
> > > Rikesh
> > > (V.InterDev6.0-SP5/W2K-SP4/SQL2K-SP3)
> > >
> > >
> > >
> > > <%
> > >
> > > Dim objConnection 'The connection object
> > > Dim objRecordset 'The recordset object
> > >
> > > ' create the Connection object
> > > Set objConnection = Server.CreateObject("ADODB.Connection")
> > > ' open the DSN
> > > objConnection.Open "Provider=sqloledb;" & _
> > > "Data Source=DEVSVR;" & _
> > > "Initial Catalog=pubs;" & _
> > > "User Id=sa;" & _
> > > "Password=admin"
> > >
> > > ' creates the recordset object
> > > Set objRecordset = Server.CreateObject("ADODB.Recordset")
> > >
> > > ' SQL String for query
> > > Dim strSQL
> > > strSQL = "SELECT au_id, au_lname FROM Authors"
> > >
> > > ' execute the SQL statement that you want
> > > ' The query should return all the data you'll
> > > ' need in your combo box
> > > objRecordset.Open strSQL, objConnection
> > >
> > > Request.Form("au_lname")
> > > Response.Write (Request.Form("au_lname"))
> > >
> > > %>
> > > <HTML>
> > > <BODY>
> > > <FORM ACTION="DBCombo.asp" METHOD=POST>
> > > <select name=cboPrimary size=1 >
> > > <!--onChange="frmTest.submit();"> -->
> > > Choose from the combo:
> > > select name="lstTopic" size="1">
> > > <%
> > > ' while we don't get the end of DataBase
> > > Do While Not objRecordset.EOF
> > > 'we put the ID at Value
> > > 'this value is important to linked tables
> > > %>
> > > <option VALUE="<%=objRecordset("au_ID")%>">
> > > <!-- This is what will appear in the combo box -->
> > > <%=objRecordset("au_lname")%>
> > > </option>
> > > <%
> > > ' Move to the next record...
> > > objRecordset.MoveNext
> > > Loop ' keep the loop
> > > %>
> > > </SELECT>
> > > </FORM>
> > > </BODY>
> > > </HTML>
> > > <%
> > > ' close the recordset object
> > > objRecordset.Close
> > >
> > > ' clean the Recordset object
> > > Set objRecordset = Nothing
> > > %>
> > >

> >
> >
> > <script language="javascript">
> > <!--
> > function ChangeSelect(which)
> > {
> > var wOne = which
> >
> > document.sel.chgsel.value = wOne;
> > }
> > //-->
> > </script>
> > </HEAD>
> >
> > <form name="sel">
> > <select name="lect" OnChange="ChangeSelect(this.value);">
> > <option value="111">111</option>
> > <option value="222">222</option>
> > <option value="333">333</option>
> > <option value="444">444</option>
> > <option value="555">555</option>
> > </select>
> > <br><br>
> > <input type="text" name="chgsel" size="20">
> > </form>
> >
> >
> > MSN : (E-Mail Removed)
> > email : (E-Mail Removed)
> > http://www.ubizcom.co.kr
> > ---------------------------------------------- From DevSonner
> >

>
>


 
Reply With Quote
 
middletree
Guest
Posts: n/a
 
      02-06-2004
hate to soudn like one of those people who always corrects others, but it's
not a combo. Call it a select, or a dropdown, or whatever you want. But
there is no such thing as a combo on web products.


 
Reply With Quote
 
rikesh
Guest
Posts: n/a
 
      02-09-2004
I'll bear that in mind in the future!!! Cheers!

"middletree" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> hate to soudn like one of those people who always corrects others, but

it's
> not a combo. Call it a select, or a dropdown, or whatever you want. But
> there is no such thing as a combo on web products.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to reference one combo box from another combo box SM Javascript 2 04-28-2007 04:49 PM
Fill Combo Box based on another Combo Box dthmtlgod ASP General 1 11-16-2005 04:08 PM
combo box selection problem Jacques Chaurette Java 0 05-31-2005 10:11 PM
COMBO BOX INSTEAD OF DROP DOWN BOX =?Utf-8?B?QW5nZWw=?= ASP .Net 3 06-29-2004 06:38 PM
Populate List Box base on Combo Box Selection Adrian ASP General 1 02-18-2004 09:49 AM



Advertisments