Last post Apr 29, 2021 02:50 AM by sking
Apr 22, 2021 01:48 AM|sking|LINK
I have 2 nav buttons. One is to go to the next page, and when you press the button, the data is saved to the database. The other button also saves the data but immediately exits to the default.aspx page. I don't want to have to repeat all my code twice
in every code behind page.
How can I structure it so that all my code to test values put into controls on the page and save to db is only in one of the subs? I was thinking about creating a session variable on the fly to store Session("Exit") but then how would I redirect the eventargs
from saveexit_Click to the next1_click sub ? Once the processing is done in Next1_click I can check the Session variable to determine which way to redirect. Is there another way?
Protected Sub SaveExit_Click(sender As Object, e As System.EventArgs) Handles SaveExit.Click
Protected Sub Next1_Click(sender As Object, e As EventArgs) Handles Next1.Click
Apr 22, 2021 06:26 AM|yij sun|LINK
According to your description,as far as I think,you could create a button to save the data to database in the master page. And the exit and next button only exit and next operations.
Apr 26, 2021 01:03 AM|sking|LINK
That is an interesting concept. I don't understand how to implement that however. The event args have to get transferred into the sub processing the click event:
After I click the button and the program starts the SaveExit.Click sub, is there a way to forward the event args to another sub after I set a session variable?
Apr 28, 2021 06:17 AM|yij sun|LINK
As far as I think,you could use EventHandler delegate and then define your own delegate to use it as parameter.
Apr 29, 2021 02:50 AM|sking|LINK
Ok, thanks. I have to do some research on this. I found this page here and there are more.