URGENT!: Saving Database information from ASP.NET Button
I am working on a seat selection page for an ASP.NET school project on movie booking system. I have created the seats using buttons (A1, A2, A3) etc.
When the user click on the button, the button colour changes and the user finalized the payment. I have an issue here. How do i save the button that has been clicked as an information into SQL Database. For instance, when the user selects Button A1 and A2, i want the information that the users have selected these 2 seats, A1 and A2 into the sql database.
URGENT!! :sad:
Naters_uk
Junior Poster in Training
50 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
You have made too much assumptions. I think it will be better if u explain with some codes. Thanks
One line in my last post maybe misleading:
Should have said
Naters_uk
Junior Poster in Training
50 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
Thanks, i understood the command argument part. However, i am still having problem understanding the second hald as below.
Then you need the one event handler which will handle all your seat buttons
protected void SeatButton_Click(object sender, EventArgs e)
{
Button theButton = (Button)sender; //now you have the button that was pressed
string theSeat = theButton.CommandArgument; // now you have the seat number
//either store it in the session and the database on some other buttons click (such as a "Book Now" button) or straight to the database on each click.. that depends on your requirements
}
[/QUOTE]
Naters_uk
Junior Poster in Training
50 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
I notice that this half seems to be explained in C#, however i am writing my codes in VB.NET. Would appreciate if you help me with this.. ;)
Then you need the one event handler which will handle all your seat buttons
protected void SeatButton_Click(object sender, EventArgs e)
{
Button theButton = (Button)sender; //now you have the button that was pressed
string theSeat = theButton.CommandArgument; // now you have the seat number
//either store it in the session and the database on some other buttons click (such as a "Book Now" button) or straight to the database on each click.. that depends on your requirements
}
[/QUOTE]
Naters_uk
Junior Poster in Training
50 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
Naters_uk
Junior Poster in Training
50 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
Sorry to bother you again. How can i store all the information (all the button clicks) as a session into the database
Naters_uk
Junior Poster in Training
50 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0