Reputation: 5887
I have the following HTML content. When i click the button, the page doesn't post to URL provided in action tag. The corresponding application is running, but still the page load of the CrossPage.aspx was not invoked. What could be the problem?
<body>
<form id="UploadForm" method="post" enctype="multipart/form-data" action="http://localhost:2518/Web/CrossPage.aspx">
<div>
<input type="file" id="BtnUpload" />
<input type="button" id="BtnSubmit" value="Submit" />
</div>
</form>
</body>
Upvotes: 0
Views: 193
Reputation: 42038
Change "button"
to "submit"
<body>
<form id="UploadForm" method="post" enctype="multipart/form-data" action="http://localhost:2518/Web/CrossPage.aspx">
<div>
<input type="file" id="BtnUpload" />
<input type="submit" id="BtnSubmit" value="Submit" />
</div>
</form>
</body>
To your <asp:button>
you have not just the Text
but also the runat
attribute right?
These w3schools pages may help you
Upvotes: 1
Reputation: 6952
If you are using the asp:button control in ASP.NET you might want to add the runat="server" to your "form".
<form runat="server" id="UploadForm" method="post" enctype="multipart/form-data" action="http://localhost:2518/Web/CrossPage.aspx">
Also if you do not want to implement the server side event handler for submit, you can use the onclientclick="submit".
<body>
<form id="UploadForm" method="post" enctype="multipart/form-data" action="http://localhost:2518/Web/CrossPage.aspx" runat="server">
<div>
<input type="file" id="BtnUpload" />
<asp:Button Text="Submit" runat="server" onclientclick="Submit" />
</div>
</form>
</body>
This works for me.
Upvotes: 1