Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to use html from and post method in asp .net(4.0) using c#.
e.g
HTML
<form name="ecom" method="post" action="redirecting url">
<input type="hidden" name="field1" value="<%= field %>">
<input type="hidden" name="field2" value="<%= field2 %>">
<input type="hidden" name="field3" value="<%= field3 %>">
<input type="submit" name="submit" value="Submit">
</form>


I want to use this,as we write in classic ASP or jsp
Posted
Updated 13-Nov-12 23:18pm
v2

 
Share this answer
 
XML
<form id="form1" runat="server">
<div>
    <asp:Literal ID="Literal1" runat="server" /><br />
    User Name: <asp:TextBox ID="UserName" runat="server" /><br />
    Password:  <asp:TextBox ID="Password" runat="server" /><br />
    <asp:Button ID="Login" runat="server"  Text="Log In" />
</div>
</form>



And change the onclick event on the button to redirect
 
Share this answer
 
Comments
avikGhosh87 14-Nov-12 5:38am    
but how can i specified method POST ??
Herman<T>.Instance 14-Nov-12 5:50am    
you can still use your POST command in the FORM object if you really want to. The button has an OnClick-event which does the same.
F-ES Sitecore 21-Oct-15 9:41am    
if you use a server-side form it will default to POST for you. The "Quick Answer" section of a forum isn't the best place to learn something from scratch, you should get a book on asp.net or at least go through some on-line tutorials and get an understanding of the basics.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900