CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Location
    Pell City, Alabama
    Posts
    126

    Arrow Simple ASP.NET Form Question

    Hello, I am hoping that some of you gurus can answer what should be a pretty simple ASP.NET question for me.

    My question is related to a form that I am building. The form consists of a data bound combo box type control and a submit button. My intention is that a user will make a selection from the combo box and then press the submit button.

    Well my form displays nicely and the data is bound to the combo box, only my form doesn't work as I intended. When I investigate whats happening I find that the action of the form is being changed. For example I have code similar to this in my aspx page

    Code:
    <form id="form1" runat="server" method="post" enctype="multipart/form-data" action="ChooseSchool.aspx" target="_self">
    However when I look at the markup that is generated and returned to my browser, I see that the forms action is no longer "ChooseSchool.aspx", instead it has changed so that the form is posting back to the same page and I want it to post to the next page!!

    In other words I see this in my Browser's source...

    Code:
    <form name="form1" method="post" action="Default.aspx" id="form1" enctype="multipart/form-data" target="_self">
    Notice that the action is not the same.

    Surely someone has run into this problem before, and I'm sure its just something silly I've forgotten to do or overlooked, but I am at a loss about what to do.

    Can anyone tell me how to prevent this from happening so that my form will submit to the action I intend ?

    Thanks!

  2. #2
    Join Date
    Sep 2004
    Posts
    65

    Re: Simple ASP.NET Form Question

    Hi Mutilated1,

    ASP.NET works differently than the old ASP. ASP.NET posts events back to itself, which is what you are experiencing. I would recommend handling the submit with a server control button instead of a input type="submit" button. Put whatever processing you need in btnSubmit_Onclick (or whatever you name it).

    HTH

    Ranthalion

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured