Problem IN Getting Data in Aspx Page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vkas
    New Member
    • Feb 2009
    • 78

    Problem IN Getting Data in Aspx Page

    I have created a page (HTMLpage1.html )
    which consist of a text feild and a dropdown menu and a button


    the code is
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Untitled Page</title>
    </head>
    <body>
        <form  action="Result1.aspx"  method="post">
            <br />
            <table>
                <tr>
                    <td style="width: 193px">
            Name:</td>
                    <td style="width: 125px">
            <input id="txtname" type="text" /></td>
                    <td style="width: 257px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 193px">
            Select A Color:</td>
                    <td style="width: 125px">
            <select size="1" name="Color" id="drpcolor">
                <option selected="selected">Red</option>
                <option>Blue</option>
                <option>Green</option>
                <option>Purple</option>
                <option>Orange</option>
            </select>
                    </td>
                    <td style="width: 257px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 193px; height: 21px">
                    </td>
                    <td style="width: 125px; height: 21px">
                    </td>
                    <td style="width: 257px; height: 21px">
                    </td>
                </tr>
            </table>
            <br />
            &nbsp;
            <input id="Button1" type="submit" value="button" /><br />
            <br />
            &nbsp;&nbsp;<br />
        </form>
    </body>
    </html>

    Now when the Submit button is clicked the form action goes to Result1.aspx


    which has the following code of line

    Code:
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <% String txtname, Color;
            
            txtname = Request.Form.Get("txtname");
            Color = Request.Form.Get("drpcolor");
            Response.Write(txtname);
            Response.Write(Color);
            Response.Write("HEllO");
             %>
    </body>
    </html>
    Now when i click the Submit button only hello is printed

    CAn any one help me in this
    Last edited by Frinavale; Feb 1 '10, 05:25 PM. Reason: Please post code in [code] ... [/code] tags. Added code tasg.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Well, I'm not sure why drpcolor is not getting to the server but it would be a lot easier for you use ASP.NET controls in an ASP.NET application. I strongly recommend that you take the time to recreate the HTML page using ASP.NET controls instead....

    -Frinny

    Comment

    • Vkas
      New Member
      • Feb 2009
      • 78

      #3
      ya i have done with both

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Did you solve your problem then?

        Comment

        • Vkas
          New Member
          • Feb 2009
          • 78

          #5
          yes my problem was solved

          Comment

          Working...