Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > combo box

Reply
Thread Tools

combo box

 
 
Eugene Anthony
Guest
Posts: n/a
 
      07-20-2005
I actually have two combo box on my .asp with the simular code as
bellow:

<select name="select2" class="TextField1">
<%
openDB()

set rs = Server.CreateObject("ADODB.Recordset")
objConn.usp_RetrieveCategories rs

do while not rs.eof
response.write "<option value=" & rs(0) & ">" & rs(1)
rs.movenext
loop

closeRS()
closeDB()
%>
</select>


The stored procedure is as bellow:

create procedure usp_retrieveCategories
AS SET NOCOUNT ON

SELECT CategoryID, CategoryDescription FROM categories

Return
GO


Now I have a table called ProductsCategories:

create table ProductsCategories
(
ItemID int,
CategoryID int
);


I also have the ItemID stored as:

ItemID = formatforDb(Request.QueryString("ItemID"))


Now what I intend to do is lets say I have ItemID 1 in
ProductsCategories table. ItemID 1 can have one or two CategoryID in
ProductsCategories table. If ItemID 1 has only one CategoryID, then the
combobox 1 should focus the CategoryID found in ProductsCategories
table. If suppose ItemID 1 has two CategoryID in ProductsCategories
table, then the first CategoryID of ProductsCategories table should be
the focused on combobox1 and the second CategoryID of ProductsCategories
table should be the focus on combobox2.

For example:

<select name="select1" class="TextField1">
<%
openDB()

set rs = Server.CreateObject("ADODB.Recordset")
objConn.usp_RetrieveCategories rs

do while not rs.eof
%>
<option value='<%=rs(0)%>' <% if rs(0)=Parent then response.write
"selected" end if %>><% =rs(1) %></option>
<%
rs.movenext
loop

closeRS()
closeDB()
%>
</select>

The purpose of the codes above is to modify an existing information
stored in the database.

How is it done?. Your help is kindly appreciated.

Regards

Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
 
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 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
Combo Box and text box Mike Javascript 2 09-24-2003 07:40 PM



Advertisments