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
Post a Comment