Click here to Skip to main content
15,885,366 members
Articles / Productivity Apps and Services / Sharepoint / SharePoint 2010

How to Customize the New Item Form to Take Parameters from Query String in SharePoint 2010

Rate me:
Please Sign up or sign in to vote.
4.00/5 (3 votes)
10 May 2011CPOL1 min read 61.5K   3   5
Explains how to customize the New Item form to get parameters from the query string in SharePoint 2010

In this article, I'm going to explain how to customize the SharePoint Item Form to take parameters from a Query String and set them as default values using the SharePoint Designer. Using this technique, you can open a new Item Form by providing parameters as query string. For example, you can customize an item display form and take a query string parameter from that form and view the New Item view for another list by providing the default values using the query string.

Steps

Open the SharePoint Designer and go to Lists and Libraries and open the list you want.

image

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

image

image

The created view will appear in the list. Click and open the view.

image

The default New Item screen will be loaded as follows:

image

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 will see the following message in the designer.

image

Go to SharePoint Controls and add the Custom List as you want.

image

Select the New Item form and click OK to add the view.

image

In my example, I want to set the comments by using the query string parameter. So I change the Comments field’s controller to a textbox.

image

Then add a parameter field to get the comments form the query string.

image

I'm passing my comments using the query string ID com and it will store it to the variable param.

image

Then select the Comments text box and switch the view to code or split designer mode.

image

image

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

image

Now you are done.

image

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Sri Lanka Sri Lanka
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionNot working in iPhone Please help me urgent Pin
Member 98629989-May-13 11:38
Member 98629989-May-13 11:38 
QuestionThanks!!! Pin
RuhrerJung26-Jun-12 21:46
RuhrerJung26-Jun-12 21:46 
QuestionTHANKKKSSSSS..... Pin
Leohh224-Jun-12 0:33
Leohh224-Jun-12 0:33 
GeneralMy vote of 2 Pin
Sravan S5-Jan-12 22:38
Sravan S5-Jan-12 22:38 
GeneralMy vote of 5 Pin
rnbergren25-Aug-11 9:15
rnbergren25-Aug-11 9:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.