asp.net - How can I trigger Html.BeginForm by clicking a button? -


here html.beginform code. want pass 2 values action checkoutproduct.
how can trigger html.beginform clicking button?

@html.beginform("checkoutproduct", "checkout") {     <input type="hidden" id="productcodeforcheckout" value="" />     <input type="hidden" id="productqtyforcheckout" value="0" /> }  <button class="btn" id="checkout"><span>add cart</span></button> 

just place submit button inside form

@html.beginform("checkoutproduct", "checkout") {     <input type="hidden" id="productcodeforcheckout" value="" />     <input type="hidden" id="productqtyforcheckout" value="0" />      <input type="submit" class="btn" id="checkout" title="add cart" /> } 

if prefer stick button instead of input, set type submit

<button type="submit" class="btn" id="checkout">...</button> 

Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -