T
teddy
I am trying to create a bookstore WebApplication using c#. I can
display the books (obtained from sql server) on a table in the WebForm
application. At the end of each row, I would like to add "add to cart"
button. Therefore, I use
Button bt_add = new Button();
bt_add.Text = "Add to cart";
and put it in each cell which is later added to a table row. The
Buttons display fine on the WebForm. However, I don't know how to add
the Button_Click function for each of the Buttons I created since I
don't know the total number of books returned by the database in
advance. Can anyone help me get "add to cart" button to work?
Note: I try clicking on each Button, the WebForm page loads back to its
original stage (Page_Load function) and my search result is gone.
Thanks,
display the books (obtained from sql server) on a table in the WebForm
application. At the end of each row, I would like to add "add to cart"
button. Therefore, I use
Button bt_add = new Button();
bt_add.Text = "Add to cart";
and put it in each cell which is later added to a table row. The
Buttons display fine on the WebForm. However, I don't know how to add
the Button_Click function for each of the Buttons I created since I
don't know the total number of books returned by the database in
advance. Can anyone help me get "add to cart" button to work?
Note: I try clicking on each Button, the WebForm page loads back to its
original stage (Page_Load function) and my search result is gone.
Thanks,