Passing data to new infopath form in form library from a sharepoint custom webpart
-
10-12-2019 - |
Question
I have a share point custom web part which has 2 text box Name
and ID
and a button.
I have a info path form called 'EmpInformation
' in the form library.So if the user hits on the button, a new info path form should be opened and Name
and ID
fields in that form should be populated by the data send by button. any suggestions
Solution
You can use Query String parameters to send to InfoPath form and if you want no code solution, you can use Query String (URL) Filter Web Part.. Following blog shows how:
How to Pass Querystring data into an InfoPath Form
If you want to access them in code, you can access like:
// URL: http://www.foo.com/bar.xsn?xyz=1
public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
// Assign the value of the parameter 'xyz' to the string 'xyzValue'
string xyzValue = e.InputParameters["xyz"];
}
OTHER TIPS
One idea can be to store the data in a List (maybe temporarily) and on InfoPath form make a connection to this List, get data from there.. If you have multiple entries in List and need to identify which one you should pick, you can still use QueryString approach to send the List Item Id..