For Closing the InfoPathform we normally using Action : “Close this form: No Prompt”
It will close the form and redirect to the same library default view.
Our requirement is redirect into another page in the same site collection.
Add the OnClose event like below code.
protected void formname_OnClose(object sender, EventArgs e)
In the Infopath Form, you must add the Action: “Close this form: No Prompt” in the rules of the InfoPath Button, otherwise the OnClose event won’t fire.
if you try this redirect to another site Collection an error will be return.(this above code will work only the same site collection).
One more solution using Sharepoint Designer
Open the Default view page – using Sharepoint Designer.
Add this below code…
<script type=”text/c#” runat=”server”>
protected void Page_Load(object sender, EventArgs e)
it will also redirect to different page…
Some more Solutions in other blogs click the below links
Solution 1 – InfoPath Forms Services close button redirection
Solution 2 – InfoPath Forms Services – What happens after a form is closed
Solution 3 – Allowing InfoPath forms to redirect to pages in other site collections
Communities Tagged : Technology