Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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 January 4th, 2005, 08:43 AM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP

I have a page where i am generating the textbox and submit button dynamically through do while loop and i have generated the session with in the loop and when i posting the form to the same page the values in the textbox is not appearing and when i refresh the page again then the values are comming to the textbox as well as on the page

here is the code

<%
    SQLStmt = "Select * from IssueDetails Where IssueID between " & 12 & " and " & 15
    Set rst = Server.CreateObject("ADODB.Recordset")
     rst.Open SQLStmt, dbCon
    'session.Abandon()

' Dim objDictionary
' Set objDictionary = Server.CreateObject("Scripting.Dictionary")
  Total=0
  'Response.write("Total is " & Request("hdTotal"))
    i=1
    Do While not rst.Eof
    %>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr>
                 <td width="31%" height="150" align="center">
                    <%
                                CheckFileExists = False
                                If Not(rst("ImgSource") = "") Then

                                    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
                                    filePath = Server.MapPath("../" & rst("ImgSource"))
                                    If (objFSO.FileExists(filePath)) Then
                                        CheckFileExists = True
                                    Else
                                        CheckFileExists = False
                                    End If

                                Set objFSO = Nothing
                                End If
                                If (CheckFileExists = True) Then
                    %>
                                    <img src="../<% Response.write rst("ImgSource") %>" width="100" >
                                <% Else %>
                                    <IMG SRC="../IssueImages/ImageNotFound.gif" BORDER="0">
                                <% End If %>
                    </td>

                    <td width="44%">
                          <table width="100%" border="0" align="right" cellpadding="0" cellspacing="0">
                                <tr>
                                      <td height="40" align="center"><SPAN class=ItermTitle><b><% Response.write rst("IssueTitle") %></b></SPAN></td>
                                </tr>
                                <tr>
                                      <td height="60" valign="top" class="shopDescription"><% Response.write rst("FeatureTopic") %></td>
                                </tr>
                                <tr>
                                      <td height="40" valign="bottom" class="shopDescription">Unit Price : <span class="navtext"><b>$<% Response.write rst("price") %></b></span> </td>
                                </tr>
                          </table>
                   </td>
                         <td width="25%">
                                <form action="search.asp?menu=shopping" method="post">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                              <td height="40" align="right" valign="top" class="text">
                                                   <%
                                                          If Not Session("Qty"&i) = "" Then
                                                               Response.write "Net Price : <span class='navtext'>$" & Session("Qty"&i) * rst("Price") & "</span>"
                                                        End If
                                                        Total=Total+ (Session("Qty"&i) * rst("Price"))
                                                    %>
                                              </td>
                                         </tr>
                                        <tr>
                                              <td height="60" align="center" valign="top" class="text">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;
                                                  <div align="center">Qty&nbsp;&nbsp;&nbsp;
                                                      <input name="txtQty<%=i%>" type="text" id="txtQty" size="3" value="<%=Session("Qty"&i)%>">
                                                  </div>
                                              </td>
                                        </tr>
                                        <tr>
                                              <td height="50" valign="bottom" class="ItermTitle"><div align="center">
                                                      <div align="center">
                                                            <input type="hidden" name="hdTotal" value=" <%Response.write(Total)%> " >
                                                          <%
                                                            If Not Request("txtQty"&i) = "" Then
                                                                Session("Qty"&i)=Request("txtQty"&i)
                                                            End If
                                                            %>
                                                          <input type="submit" name="Submit" value="Add to Cart">
                                                    </div>
                                                </td>
                                        </tr>
                                    </table>
                                </form>
                            </td>
        </tr>
    </table>


<%

                'objDictionary.Add Cstr(rst("IssueID")),session("Qty"&i) * rst("Price")
    i=i+1
    rst.MoveNext
    Loop

    rst.close
    dbCon.close
    set dbCon=Nothing
    Response.write("Total is "& Total & "<br>")
' Dim arrItems, iCounter

' arrItems = objDictionary.Items
' keyItems=objDictionary.Keys
' Response.Write "[list]"
' For iCounter = 0 To objDictionary.Count - 1
' Response.Write "<li> item = " & arrItems(iCounter) & "key=" & keyItems(iCounter) & "</li>"
' Next
' Response.Write "</ul>"


'Set objDictionary = Nothing
dim i
For Each i in Session.Contents
  Response.Write(i & " value " & session.contents(i)&"<br />")
Next


%>


D.kumar
 
Old January 4th, 2005, 05:07 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I am missing the part where this gets related to .NET in general and to Visual Studio in particular.

If I am not overlooking something, I think you're better off posting this in one of the ASP forums, like: http://p2p.wrox.com/forum.asp?FORUM_ID=65 or http://p2p.wrox.com/forum.asp?FORUM_ID=56
If you do post there, can you remove irrelevant parts of the code (like the commented stuff and parts of the HTML)? Without nice color coding in this web page, it's hard to see what's important and what's not.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Suck it Up by Hed Planet Earth (Track 1 from the album: Blackout ) What's This?





Similar Threads
Thread Thread Starter Forum Replies Last Post
send parameters from asp page to an asp.net form hastikeyvan ASP.NET 1.0 and 1.1 Basics 2 March 29th, 2008 01:32 AM
using asp.net web user control in asp 3.0 App i_shahid Classic ASP Professional 0 January 8th, 2008 07:32 AM
Custom HTTP 404 Problem w/ASP to ASP.NET kwilliams ASP.NET 2.0 Professional 7 November 26th, 2007 04:17 PM
Upgrading ASP w/ SQLserver 2000 to ASP.NET w/2005 cJeffreywang ASP.NET 2.0 Basics 1 April 5th, 2007 11:30 PM
Porting a sa,ple ASP CR viewer app to ASP.NET jhansen42 Crystal Reports 0 August 29th, 2003 10:26 AM





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