Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 8th, 2004, 10:30 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default When I hit save button the selected employee clear

When I hit save button, the names which are in the List box When
I select one of them. When I hit save button, it goes off, but it saves in the data base. When I try to retrieve it, it displays the one
which I selected. I dont want the one to be clear off when i hit save button.


 
Old September 8th, 2004, 08:33 PM
Authorized User
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

assume you are using "save" as type of submit, after submit to the same page, you should let list box know what you have been submitted.
do this:
<select name=slt>
<option selected value=<%=request.form("slt")%> request.form("slt") </option>
'if u get more options juz do it like before
</select>

cheers

 
Old September 8th, 2004, 11:34 PM
Authorized User
 
Join Date: Aug 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sinapra Send a message via MSN to sinapra Send a message via Yahoo to sinapra
Default

hi
I am not really sure what exactly you mean here, say you have a form with list of entries to be made and a list box which displays some LOV's. Now do you mean to say that once you hit the save button, it should save the entries in DB and return back to the same form with new entry?? do let me know with clarity.
Regards

sinapra
 
Old September 11th, 2004, 10:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi shoakat,

I had posted the answer to similar query from you a couple of months back. But did not know from you then, if you tried that or successfuly incorporated that method.

Take a look at that thread here --> Html Read my second reply to that post. That holds the answer for this post.

sinapra,
He wants to maintain the same value being SELECTED on the list box after writing it to the database.

In this case the requested value should be used in place of constants there in the other post I referred here.

Eg:
Code:
SelVal=Request.Form("lstControl")
...
...
'HTML code should look like...
<select name="lstControl">
    <Option value="whatever" <%if SelVal="whatever" then %> SELECTED <%End If%>>whatever</option>
    <Option value="whatever xyz" <%if SelVal="whatever xyz" then %> SELECTED <%End If%>>whatever xyz</option>
    ...
</select>
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old September 13th, 2004, 03:28 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually the list Box has like hundreds of employees name
present in the data base. I can add employee and delete employees
easily in the data base. The code you are referring will not work in this case employees name goes on changing, we can add or delete any time we create. the code which you refereed works fine if there are three or four options. But in employee there are 100 of employees. So hard coding is not possible.
 what i am trying to do
if strEmpId ="" or isNull(strEmpId then
str empid ="0"
end if
if strReports ="" or isNull(strReports) then
strReportsTo="0"
 if cInt(strReports) = cint(EmpId)
str selected = " selected ". The problem is that i dont understand the code. I know what it is doing. Your help will be appreciated

 
Old September 13th, 2004, 03:40 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What I am trying to do employees are reporting to different bosses.
The employees bosses change whenever I want to. I have created two
objects one for employee and other for manager. Employees are itself
managers. Managers are in the list box and they are in the db. So I am checking in the loop. So what happens when I select managerName in the list box and I hit save. It saves in the data base, but i dont want the manager name which I selected to clear off when I hit save button.
shoakat

 
Old September 16th, 2004, 01:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

The code I posted it a sample that does what exactly you wanted. But there the data is constant as per my code. You can use the same logic to implement that with values from database.

Hope that explains.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Save button riaz Java GUI 1 April 16th, 2007 11:44 PM
binding textboxes to selected radio button abhi_loveu2002 ASP.NET 2.0 Basics 0 December 20th, 2006 05:54 AM
how to show a button when save is done noor ASP.NET 1.0 and 1.1 Basics 4 May 9th, 2005 12:49 AM
How to create a "Clear Button" phudong3da Dreamweaver (all versions) 1 May 3rd, 2005 02:48 PM
Page display based on radio button selected Mekala HTML Code Clinic 3 July 10th, 2004 06:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.