Submit a Javascript Button from C# behind?

Joined
Jan 30, 2009
Messages
1
Reaction score
0
Hi,

I will try to make my question as simple as possible.

I have a website build in .NET (using C#). It displays a list of products that are retrieved from a DB. Within the itemtemplate of that Datalist (that displays the products) I also put a LinkButon that executes a code and this Linkbutton acts as an ADD to Cart button. The code that is being executed retrieves the product's name and price and saves these values into 2 session variables.


Then I have the following HTML tag that puts the values (name, price -now saved in the Session Variables) into a Button:

<input id="product_name" value='<%Response.Write(Session["Selected_add_to_cart_name"]);%>' class="product-title" type="hidden">
<input id="product_price" value='<%Response.Write(Session["Selected_add_to_cart_price"]);%>' class="product-price" type="hidden" >
<div title="Add to cart" role="button" tabindex="0" class="add-button" type="hidden">

a Javascript then executes an external code (since I am using an external Shopping Cart):

<script id='cart-script' type='text/javascript' src='https://xx integration='jscart-wizard' post-cart-to-sandbox='false' currency='GBP'></script>




My problem is that I can click on the LinkButton that I created but I also have to click on the button I just pasted above.. only then will my 'name and price' values be passed to the external shopping cart.

What I want to do is automatically call this Javascript from C# behind (After the 'Add to Cart' Linkbutton is executed)


Please I need this urgently, any help will be very much appreciated.

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top