Question on PostBack method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krithikav
    New Member
    • Sep 2007
    • 7

    Question on PostBack method

    Is there a method in ASP similar to PostBack method in ASP.NET? I have an asp file which reads each line in a text file as hyperlink, when clicked, shows the details of the product of that line. I would like to get both the asp pages to be visible in the same window. How do I achieve this?

    Please help.

    Krithika
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Krithika,

    You can do similar things to postBack in ASP, but you will have to code it yourself. When you say you want two pages in the same window, how do you mean?

    Jared

    Comment

    • krithikav
      New Member
      • Sep 2007
      • 7

      #3
      Originally posted by jhardman
      Krithika,

      You can do similar things to postBack in ASP, but you will have to code it yourself. When you say you want two pages in the same window, how do you mean?

      Jared
      I have a form which, when submitted shows some result. I want this result along with the form(showing previous selection) in the same window. Now when I call the asp file in the action, it shows the result in the new window. So I'm not able to see the form and the results together.

      Is it possible to achieve this?

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        Originally posted by krithikav
        ...Is it possible to achieve this?
        absolutely. first, make sure the action attribute is the same page as the starting page. You fill in the inputs of the form using <%=request.form ("inputName")%> and put the result within an if...then statement so that it only displays if the form was submitted. The page might look something like this:
        [code=asp]<form method="post" action="thisSam ePage.asp">
        Type your name here: <input type="text" name="userName"
        value="<%=reque st.form("userNa me")%>"><br>
        How old are you? <input type="text" name="age"
        value="<%=reque st.form("age")% >"><br>
        What is your favorite color? <select name="favColor" >
        <%
        dim opt(6), x
        opt(0) = "red"
        opt(1) = "orange"
        opt(2) = "yellow"
        opt(3) = "green"
        opt(4) = "blue"
        opt(5) = "indigo"
        opt(6) = "violet"
        for x = 0 to 6 %>
        <option value="<%=opt(x )%>"
        <%
        if opt(x) = request.form("f avColor") then response.write "selected" %>
        ><%=opt(x)%></option>
        <%
        next %>
        </select>
        <input type="submit" name="submit" value="submit"> </form><br>
        <%
        if request.form("s ubmit") <> "" then %>
        <p><%=request.f orm("userName") %> is <%=request.form ("age")%> years old.
        <p><%=request.f orm("userName") %>'s favorite color is <%=request.form ("favColor") %>
        <%
        end if %>[/code]Let me know if this helps.

        Jared

        Comment

        • krithikav
          New Member
          • Sep 2007
          • 7

          #5
          Thank you very much for your timely help. Your suggestion has helped me finish my work. Thanks again.

          Krithika

          Comment

          Working...