I have two applications: 1 is an asp.net web forms and 2 is an asp mvc. I want that from the application 1, when user clicks on a button (or something similar) to open another window in browser. In the background, on the button click I need to send json data computed from application 1 to the mvc application 2 through a post. The controller from MVC which receives the post then will return an action result as a view. This view I need to display in the window that opens from the button (or whatever it needs to be) click event. The problem is that I need to run some code from the application 1 when the button is clicked, right before I invoke the post method. Right now I am able to do this by using javascript in application 1, but it is not enough for me, since now I need to run some code before the post method. The way it is working right now is having a javascrip text to be loaded to application 1 in an asp literal, which have the following format:

<form action='some/url' method='post' target ='_blank'>
<input type='hidden' name='dto' value='{0}'>
<input type='submit' value = 'Show printable report'>

As can be seen there is a post, and the button is made with the "type=submit" directive.

The target ='_blank' opens the result in a new tab.

Can this button be turned in some asp.net control, to enable me to add an event to it, and keep the same functionalities it has by now?

Any suggestion is well received.

Related posts

Recent Viewed