Thursday, November 18, 2010

How to Customize New Item Form to take parameters from Query String in the SharePoint 2010

In here I'm going to explain how to customize the SharePoint Item From to take parameters from Query String and set them as default values using SharePoint designer. Using this you can open a new Item From by providing parameters as query string. For an example you can customize one item Display form and taking query String Parameter from that and view New Item view for another list by providing default values using the Query String.  

Steps

Open the SharePoint designer and go to list and libraries and open the list that you want.

image

Click the New and create a New Insert View by providing the name of the view.

image 

image

Then created one will come to the list. then click and open the view.

image

Then default New Item Screen will be loaded as follows.

image

Then Delete the default list view and make that empty. You can delete the controls by selecting the area in the design view, If it fully cleared you can view the following message from the designer.

image

Then go to SharePoint Controls and add the a Custom List as you want.

image

Then select the New Item Form and click ok to add the view.

image

In My Example I want to set the comments by using Query String Parameter. there for first i change the comments field’s controller to textbox.

image

Then Add parameter field to get the comments form the Query String.

image

I'm passing my comments using query string ID com and it is storing in to the variable param.

 image

Then select the comments text box and switch the view to code or split designer mode,

image

image

In here go and change the text property to {$param} This will set the query string parameter to the text box.

image

Then you done.

image

Post a Comment