|
I have a web application using classic ASP. It displays products on a page, from which the user can select. There are 30 products per page, and there are 120 products in total. So it is 4 pages.
When the user selects products, he can go to the next page, and also select a couple of products. But the products chosen from the previous page must still be available somewhere, maybe in a session variable, or something. Lets say the user chose product A from the first page and wants to delete it, he must just deselect the checkbox and it should be taken out of the session.
Can someone please explain to me how this can be done, and if session variables are the only solution to my problem. Maybe javascript can be used as well.
Help would be appreciated.
Brendan
|
|
|
|
|
Hi Brendan:
You seem to feel that using a session is something that you dont want to do although I am not entirely sure why. Usually when you are working ASP you use a session to persist variables throughout the website.
You cant really use Javascript because if you do then you will lose track of the variable as soon as you switch pages. Javascript isnt really intended for this.
I hope this answers your question, please ask more if you have them!
Jamieson
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
I would suggest you use cookies through JavaScript.
Google the phrase "javascript cookies" and you will find alot of information about them.
theJazzyBrain
Excellence is not an act, but a habit! Aristotle
|
|
|
|
|
An alternative to Cookies is to define a session variable using the navigator object, e.g.
window.navigator.session = "[put session info here]";
This defined variable is persistent for as long as the browser window is open, no matter how many new pages are loaded. You can use it just like a Cookie to track session information and it can be modified just like any other string variable.
|
|
|
|
|
I am writing a client/server application and users are going to be accessing server side documents via their web browser. I was wandering if there is any client side event like an "onsave" event so that i can capture when users go to "File > Save As".
I need this becouse i have a script that i am going to modify that goes into the clients machine and uploads files onto the server. In this scenerio, if the user is revising a server side document and clicks "File > Save As" i will prompt the user and ask if he/she would like to save the file on the server also. If they pick yes then i will overwrite the server side document with their local modified document.
Any ideas about how to get this to work or what event i can use?
|
|
|
|
|
I use dll in web application but dllhost use meny memory please help me .
|
|
|
|
|
To stream the live video from webcam and stream in intrenet explorer in system( as server) and sending that output as to the (PPC)Pocket PC (as client) as input and stream in PPC in internet explorer.
plz, if anybody done this before or related to this, send sample code.
help me to do this.valuable suggestions are welcome.
very urgent.thanx.
|
|
|
|
|
Hi
Im accessing the client Web Service. Im giving the proxy setting through IWebProxy interface.
When i connect to the Webservice first time it doesnt get connected but if i connect to the webservice through IE by .asmx file and then access through the Application then it access the WS.
but after some time if i try to access again trough app then again shows error of connection failed.
|
|
|
|
|
ASP VB Script
If I use:
If MemberId = CInt(rso.Fields("MemberId").Value) Then Response.Write("selected")
I get no error, and I can add and update record. But I can not Delet record.
If I use
If intMemberId = CInt(rso.Fields("MemberId").Value) Then Response.Write("selected")
I gett an error when I shal add an new error. But I can update record and delet record
I am new on this so there is something I miss
Thanks for any help
Erik Gjertsen
|
|
|
|
|
Have you declare intMemberId ?
<italic>Work hard, Work effectively and a bit of luck is the key to success.
|
|
|
|
|
I am new on this, So I need an explain what you mean
Thansk
Erik Gjertsen
|
|
|
|
|
Declare the variable with Dim intNumber . Have you declare that?
<italic>Work hard, Work effectively and a bit of luck is the key to success.
|
|
|
|
|
I bring you code. So you can se it.
Thanks
Erik Gjertsen
<%@ LANGUAGE="VBScript"%><br />
<br />
<br />
<%<br />
Dim rso<br />
Dim strAction<br />
Dim intMemberId<br />
Dim sqlStatement<br />
Dim strFirstname<br />
Dim strLastname<br />
Dim strAddress<br />
Dim intPostalCode<br />
Dim strPostalOffice<br />
Dim strEmail<br />
Dim ErrorMessage<br />
Dim strMemberImage<br />
Dim strCategoryid<br />
<br />
ErrorMessage = ""<br />
sqlStatement = ""<br />
strAction = Request.Form("action")<br />
Set rso = Server.CreateObject("ADODB.RecordSet")<br />
If CInt("0" & Request.QueryString("memberid")) <> 0 Then<br />
intMemberId = CInt("0" & Request.QueryString("memberid"))<br />
Call GetMemberInformation()<br />
ElseIf CInt("0" & Request.Form("memberid")) <> 0 Then<br />
intMemberId = CInt("0" & Request.Form("memberid"))<br />
Else<br />
intMemberId = 0<br />
End If<br />
<br />
If REQUEST_METHOD="POST" Then<br />
Select Case strAction<br />
Case "get"<br />
GetMemberInformation()<br />
Case "save"<br />
Call SaveMember()<br />
Case "delete"<br />
Call DeleteMember()<br />
Case "new"<br />
Call NewMember()<br />
Case "upload_image"<br />
Response.Redirect("UploadFile.asp?memberid=" & intMemberId)<br />
End Select<br />
End If<br />
<br />
Private Sub SaveMember()<br />
Dim arrSql(6)<br />
<br />
If "" & Request.Form("firstname") = "" Then ErrorMessage = ErrorMessage & "Fornavn kan ikke være tomt!<br>"<br />
If "" & Request.Form("lastname") = "" Then ErrorMessage = ErrorMessage & "Etternavn kan ikke være tomt!<br>"<br />
If "" & Request.Form("postalcode") = "" Then ErrorMessage = ErrorMessage & "Postnummer kan ikke være tomt!<br>"<br />
If ValidatePostalCode(CInt("0" & Request.Form("postalcode"))) = 0 Then ErrorMessage = ErrorMessage & "Du har ikke tastet inne et gyldig postnummer!<br>"<br />
<br />
If ErrorMessage = "" Then<br />
arrSql(0) = "'" & Request.Form("firstname") & "'"<br />
arrSql(1) = "'" & Request.Form("lastname") & "'"<br />
arrSql(2) = "'" & Request.Form("address") & "'"<br />
arrSql(3) = Request.Form("postalcode")<br />
arrSql(4) = "'" & Request.Form("email") & "'"<br />
arrSql(5) = "'" & Request.Form("CategoryID") & "'"<br />
<br />
<br />
If intMemberId = 0 Then<br />
sqlStatement = "INSERT INTO [Member] (Firstname, Lastname, Address, PostalCode, Email, CategoryID) VALUES (" & arrSql(0) & ", " & arrSql(1) & ", " & arrSql(2) & ", " & arrSql(3) & ", " & arrSql(4) & ", " & arrSql(5)& ")"<br />
Else<br />
sqlStatement = "UPDATE [Member] SET [Firstname]=" & arrSql(0) & ", [Lastname]=" & arrSql(1) & ", [Address]=" & arrSql(2) & ", [PostalCode]=" & arrSql(3) & ", [Email]=" & arrSql(4) & ", [CategoryID]=" & arrSql(5) & " WHERE MemberId=" & intMemberId<br />
End If<br />
<br />
On Error Resume Next<br />
DbConnection.Execute(sqlStatement)<br />
On Error Goto 0<br />
<br />
If intMemberId = 0 Then<br />
sqlStatement = "SELECT @@Identity AS MemberId"<br />
<br />
On Error Resume Next<br />
Set rso = DbConnection.Execute(sqlStatement)<br />
On Error Goto 0<br />
<br />
If Not rso.EOF Then<br />
intMemberId = rso.Fields("MemberId").Value<br />
End If<br />
<br />
Set rso = Nothing<br />
End If<br />
<br />
Call GetMemberInformation()<br />
End If<br />
End Sub<br />
<br />
Private Sub DeleteMember()<br />
sqlStatement = "DELETE FROM Member WHERE MemberId=" & intMemberId<br />
<br />
On Error Resume Next<br />
DbConnection.Execute(sqlStatement)<br />
On Error Goto 0<br />
<br />
Call NewMember()<br />
End Sub<br />
<br />
Private Sub NewMember()<br />
intMemberId = 0<br />
strFirstname = ""<br />
strLastname = ""<br />
strAddress = ""<br />
intPostalCode = "0000"<br />
strPostalOffice = ""<br />
strEmail = ""<br />
strCategoryID = ""<br />
End Sub<br />
<br />
Private Sub GetMemberInformation()<br />
sqlStatement = ""<br />
sqlStatement = sqlStatement & "SELECT m.[Firstname], m.[Lastname], m.[Address], m.[PostalCode], p.[PostalOffice], m.[Email], m.[MemberImage], m.[CategoryID] "<br />
sqlStatement = sqlStatement & "FROM [Member] m, [Post] p "<br />
sqlStatement = sqlStatement & "WHERE m.[PostalCode]=p.[PostalCode] AND m.[MemberId]=" & intMemberId<br />
<br />
On Error Resume Next<br />
Set rso = DbConnection.Execute(sqlStatement):CheckError(sqlStatement)<br />
On Error Goto 0<br />
<br />
If Not rso.EOF Then<br />
strFirstname = rso.Fields("Firstname").Value<br />
strLastname = rso.Fields("Lastname").Value<br />
strAddress = rso.Fields("Address").Value<br />
intPostalCode = PrepNrAsPostalCode(rso.Fields("PostalCode").Value)<br />
strPostalOffice = rso.Fields("PostalOffice").Value<br />
strEmail = rso.Fields("EMail").Value<br />
strMemberImage = rso.Fields("MemberImage").Value<br />
strCategoryID = rso.Fields("CategoryID").Value<br />
End If<br />
<br />
Set rso = Nothing<br />
End Sub<br />
%><br />
<html><br />
<head><br />
<title>Medlemsdetaljer</title><br />
<br />
<script src="Scripts/Scripts.js" language="javascript"></script><br />
</head><br />
<body><br />
<form name="oForm" id="oForm" method="post" action="<%=SCRIPT_NAME%>"><br />
<h4>Detaljinformasjon<br><br />
<a href="Search.asp">Tilbake</a> </h4><br />
<table border="0" cellpadding="2" cellspacing="2" style="border: solid 1px #000000;"><br />
<tr><br />
<td valign="top"><br />
<table cellpadding="2" cellspacing="2" width="100%" border="0"><br />
<% If ErrorMessage <> "" Then rw("<tr><td colspan=""2""><font class=""ErrorLabel"">" & ErrorMessage & "</font></td></tr>") %><br />
<tr><br />
<td><font class="TextLabel">Velg medlem</font></td><br />
<td><br />
<select name="MemberId" id="MemberId" onchange="doPostPage('get');" class="DropDownList"><br />
<option value="">Velg medlem</option><br />
<%<br />
sqlStatement = "SELECT [MemberId], [Firstname], [Lastname] FROM [Member] ORDER BY Lastname"<br />
<br />
On Error Resume Next<br />
Set rso = DbConnection.Execute(sqlStatement):CheckError(sqlStatement)<br />
On Error Goto 0<br />
<br />
Do While Not rso.EOF<br />
Response.Write("<option value=""" & rso.Fields("MemberId").Value & """")<br />
<br />
If intMemberId = CInt("0" & rso.Fields("MemberId").Value) Then Response.Write("selected") <br />
<br />
rw(">" & rso.Fields("Firstname").Value & " " & rso.Fields("Lastname").Value & "</option>")<br />
rso.MoveNext<br />
Loop<br />
<br />
Set rso = Nothing<br />
%><br />
</select><br />
</td><br />
</tr><br />
<tr><br />
<td><font class="TextLabel">Medlems ID</font></td><br />
<td><input type="text" name="memberid" id="memberid" value="<%=PrepareNumber(intMemberId, 5)%>" class="TextBox" readonly="true"/></td><br />
</tr><br />
<tr><br />
<td><font class="TextLabel">Fornavn</font></td><br />
<td><input type="text" name="firstname" id="firstname" value="<%=strFirstname%>" class="TextBox" /></td><br />
</tr><br />
<tr><br />
<td><font class="TextLabel">Etternavn</font></td><br />
<td><input type="text" name="lastname" id="lastname" value="<%=strLastname%>" class="TextBox" /></td><br />
</tr><br />
<tr><br />
<td><font class="TextLabel">Adresse</font></td><br />
<td><input type="text" name="address" id="address" value="<%=strAddress%>" class="TextBox" /></td><br />
</tr><br />
<tr><br />
<td><font class="TextLabel">Postnummer/sted</font></td><br />
<td><br />
<table cellpadding="0" cellspacing="0" border="0"><br />
<tr><br />
<td><input type="text" name="postalcode" id="postalcode" value="<%=intPostalCode%>" class="TextBox" style="width: 80px;" /></td><br />
<td> </td><br />
<td><input type="text" name="postaloffice" id="postaloffice" value="<%=strPostalOffice%>" class="TextBox" style="width: 166px;" readonly="true" /></td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
<tr><br />
<td><font class="TextLabel">E-Post</font></td><br />
<td><input type="text" name="email" id="email" value="<%=strEMail%>" class="TextBox" /></td><br />
</tr><br />
<tr><br />
<td>Kategori</td><br />
<td><input type="text" name="CategoryID" id="CategoryID" value="<%=strCategoryID%>" class="TextBox" /></td><br />
</tr><br />
</table><br />
</td><br />
<td valign="top"><br />
<% If strMemberImage <> "" Then %><br />
<img src="MedlemsBilder/<%=strMemberImage%>" border="0" width="200" height="200" alt="" /><br />
<% End If %><br />
</td><br />
</tr><br />
<tr><br />
<td colspan="2"><table border="0" cellpadding="0" cellspacing="0" ID="Table1"><br />
<tr><br />
<td><input type="button" value="Lagre" class="Button" onclick="doPostPage('save');" /></td><br />
<td> </td><br />
<td><input type="button" value="Ny" class="Button" onclick="doPostPage('new');" /></td><br />
<br />
<td> </td><br />
<td><input type="button" value="Slett" class="Button" onclick="doPostPage('delete');" /></td><br />
<td> </td><br />
<td><input type="button" value="Last opp bilde" class="Button" onclick="doPostPage('upload_image');" /></td><br />
<br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<input type="hidden" name="action" id="action" value="" /><br />
</form><br />
</body><br />
</html>
|
|
|
|
|
It's hard to check from your code. I suggest you check the query.
use response.write yourSQlStatement . Good luck.
<italic>Work hard, Work effectively and a bit of luck is the key to success.
|
|
|
|
|
While using Security Application Block, the documentation says that the Security Application Block includes a file SecurityDatabase.sql that generates the script for the particular schema. I don't seem to have the script file. If someone has used Security Application Blocks, please let me know if this script should be run and if so where do I download it.
|
|
|
|
|
Hi, I put the java file test.java in the classes folder under WEB-INF. When I run the jsp that references the javabean, it says "cannot find symbol". The jsp files has this line:
<jsp:usebean id="test" class="test" scope="page">
The class in test.java is test (of course).
The reference in jsp is <%= test.method(value); %>.
What's gone wrong?
|
|
|
|
|
I am web developer and used ASP to develop the website. but still i have a problem with sending E-Mail.
I want to know about free CDONTS E-Mail service. Is there anyone to help me ???
Kanchan Subba
|
|
|
|
|
try this[^]
<italic>Work hard, Work effectively and a bit of luck is the key to success.
|
|
|
|
|
I have a web site that displays a table of records and each line has a microphone icon on it. When the user clicks on that mic icon another web page is opened and it tells the user they may create a dictation. (We have special dictation mics running from a vb.net app that runs from the user's local machine.) We also have an image display program running at the same time and it also runs from the user's machine.
The web app knows what the StudyID is but the vb.net apps don't and I need to be able to pass that StudyID to the users machine so it can be used by the image display program to find the correct images to display while the user is dictating.
I wrote a "faux" activeX (dll) in vb.net that could be placed on the web site and run when the 2nd page is displayed and the studyID could be passed to it and then it would use the study ID and the Process class to cause the image display program to display the correct images, but that would require each user's machine to have the correct security manually setup in .Net Configuration and we don't want to have to do that.
So I am trying to determine if there is a solution to this situation that would require very little security setup on the users machine.
So basically I need a program (probably an ActiveX) that can be run from my web page but then it would start a program on my user's system using data from the web page.
Does this make sense? Could this be done and if so, would it be as easily done as I think it might be.
I'm looking for working suggestions, so any opinions are welcomed.
|
|
|
|
|
I installed SASDK beta 1.1 on my computer with Visual Studio.
But when i try to create speech projects from VS item, le speech application projects wizzard produces error like "Wait for an objet", code 0, and it's unable to execute scripts on htm pages c:\program files\microsoft visual...\...html\1033\default.htm.
I tried configure IE6 without succes.
This wizzard should work on the feature of the application and i cannot excute it because of langage or voice errors on debbugging tool.
Please, if you can help a poor south french guy who need finish a software quickly ..
Bruno
|
|
|
|
|
I have an asp page with various subroutines that I use as an include file. I'm trying to get my onchange event for an input text field to work from this page. This is strictly asp code (<% %> ) not vbscript ( ) because I need to access the database. I haven't been able to get that to work under vbscript. But I also can't get the event to run from the asp page. This is very aggravating. Any help would be greatly appreciated.
I have the include file at the top of the page.
This is the subroutine I want to run.
<%
sub EmailChgd()
dim rsEmp, strSQL
set rsEmp = server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM Users WHERE Email='" & Request.Form("Email") & "' AND Active = true"
rsEmp.Open strSQL,AdjLinkConn,2,2
if rsEmp.EOF then
errmsg = "This user does not exist in the database."
else
if Request.Form("mgrid") = rsEmp("EmployeeId") then
errmsg = "You cannot modify your own record."
else
Session("Email") = Email
end if
end if
rsEmp.Close
set rsEmp = nothing
end sub
%>
This is my input statement.
Email: I am a newbie in ASP, but I thought this should work.
Rhonda
|
|
|
|
|
What you're coding is all VBScript, the difference being that using the <% %> tag causes it to run on the server, while the pair causes execution on the client machine. The ASP code extends the VBScript instruction set.
It's not clear what your intended result is here. It looks like you want to make an error message appear. In order to do so you have to use a Response.Write statement to cause an output at the client.
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
The errmsg variable is being displayed elsewhere. I'm trying to get the onchange event to run the server side code which is in an include file. So far, I can't get it to do that.
|
|
|
|
|
gagirl_43,
Did you ever get an answer to this question? I'm trying to do the almost the same thing: I want to call a subroutine when the value of an input control changes. I tried using the onchange event, but that only fires if the focus leaves the control, i.e. the user clicks outside of it after changing its contents.
My application requires its users to scan a barcode; the scanner completes the entry by adding an Enter after the data. I don't want them to have to click somewhere else on the page to fire the event.
If I use this input field in a form, it fires off a POST event after the Enter key, refreshing the page, which is NOT what I want. I want to have some way of calling my sub (on the same .asp page).
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
Hey Jesse,
Sorry I can't be of any help. I never did get an answer and I don't remember what I finally ended up doing. But I'm pretty sure I had to jump thru hoops in order to get what I wanted.
Rhonda
|
|
|
|