Reference URL
http://blog.karstein-consulting.com/2010/12/29/walkthrough-create-custom-sharepoint-2010-list-form-for-deployment-in-a-visual-studio-2010-project/
Walkthrough: Create custom SharePoint 2010 list form for deployment in a Visual Studio 2010 project
(This is part 1 of 2. See link below.)
Today I want to show you how to create a custom list form for deployment within a custom list template developed in Visual Studio 2010.
Download or update or modify my demo code on Codeplex.com:
http://spcustomlistformdemo.codeplex.com/
For me I was difficult to figure out this way. I could not find a good documentation about this topic so Iāll write ist
ā If you found another description please post a link in the comments below. Thanks!
1. Create a Site Collection in your SharePoint 2010. Mine is called āhttp://sharepoint.local/sites/listformā
2. In Visual Studio 2010 create an empty SharePoint 2010 project.

Choose āDeploy as farm solution!ā

3. Add new item to you project: āList Definitionā with type āCustom listā and with āAdd a list instanceā


4. Deploy this project āas isā.
5. Have a look in your browser:

6. Open SharePoint Designer 2010 (SPD) and open the site āhttp://sharepoint.local/sites/listformā. Open the deployed list āSPCustomListFormDemo ā ListInstance1ā

7. In the SPD in the List Settings of āSPCustomListFormDemo ā ListInstance1ā click the Ribbon tab āList Settingsā. Then click āList Formā. You get this dialog:

Enter the name of the new list form, e.g. ānew2.aspxā.
8. In SPD in the List Settings in the āFormsā view you can see your newly created list form.

Select it and open it for edit.
Click āAdvanced Modeā in the Ribbon !!!

Select all the content of the new2.aspx file.
Copy the HTML code.
Open NOTEPAD and paste the HTML code.

9. Go into your project in Visual Studio 2010. There add a new project item of type āApplication Pageā. Name it ānew2.aspxā.

The page will be created in folder āLayoutsSPCustomListFormDemoā

With ādrag & dropā Move the new2.aspx note to your List Definition:

Remove the āLayoutsā folder. You get:

Select ānew2.aspxā in the Solution Explorer and change its property āDeploymentTypeā to āElementFileā

10. In VS2010 open ānew2.aspxā for edit. Delete all content of the file except this two lines:

Replace the āDynamicMasterPageFileā attribute name through āMasterPageFileā. You get:

11. Got to NOTEPAD. Remove the āPageā tag as marked in the screenshow:

Select the rest of the file and copy it to the clipboard.
Now remove the complete content of the āZoneTemplateā node. ā Do not remove the āZoneTemplateā node itself. Now the specific part of ānew2.aspxā looks like this:

(There is a āDataFormWebPartā included in the āZoneTemplateā node. This you remove by following the last step from above. But at runtime SharePoint will create a new DataFormWebPart in the Web Part Zone with ID āMainā. Thatās the reason why we need to remove the copied and pasted Web Parts: Itās one of such a DataFormWebPart too much on the site after SharePoint creates the new one on runtimeā¦)
12. In VS2010 paste the code into ānew2.aspxā
13. Open ānew2.aspx.csā from the Solution Explorer:

Insert this āusingā:

Replace the base type of your class definition from āLayoutsPageBaseā to āWebPartPageā.
14. In the Solution Explorer open āschema.xmlā of your list definition:

Scroll to the bottom of the file and find this part of XML code:

Replace the āSetupPathā attribute of the Form node with type āNewFormā with this value:features$SharePoint.Feature.DeploymentPath$ListDefinition1new2.aspx
You get:

15. Deploy your solution.
16. Go into the browser, reload the list and āadd new itemā.
Now your custom list form will be used!
The URL in the Browser is identically to the first try! Why is it āNewForm.aspxā and not ānew2.aspxā?
-> SharePoint uses āNewForm.aspxā as page for āAdd new itemā but internally redirects to the defined āNew Formā of the list.
You can add some code for demo purpose to help you identifying your custom list form. For that reason I inserted
<h1>Hello World</h1>
into the the ASP Content PlaceHolder āPlaceHolderMainā:

The final result:

Now you can do your own staff on your custom list form.
Part Two Your can check here
Regards
3art Technology Experts
http://www.3art.tech
http://blog.karstein-consulting.com/2010/12/29/walkthrough-create-custom-sharepoint-2010-list-form-for-deployment-in-a-visual-studio-2010-project/
Another post
http://www.ilikesharepoint.de/2013/11/sharepoint-create-custom-list-forms-with-visual-studio-part-1/Check out the other solution for 2013
http://www.ilikesharepoint.de/2013/11/sharepoint-create-custom-list-forms-with-visual-studio-part-1/Walkthrough: Create custom SharePoint 2010 list form for deployment in a Visual Studio 2010 project
(This is part 1 of 2. See link below.)
Today I want to show you how to create a custom list form for deployment within a custom list template developed in Visual Studio 2010.
Download or update or modify my demo code on Codeplex.com:
http://spcustomlistformdemo.codeplex.com/
For me I was difficult to figure out this way. I could not find a good documentation about this topic so Iāll write ist

1. Create a Site Collection in your SharePoint 2010. Mine is called āhttp://sharepoint.local/sites/listformā
2. In Visual Studio 2010 create an empty SharePoint 2010 project.

Choose āDeploy as farm solution!ā

3. Add new item to you project: āList Definitionā with type āCustom listā and with āAdd a list instanceā


4. Deploy this project āas isā.
5. Have a look in your browser:

6. Open SharePoint Designer 2010 (SPD) and open the site āhttp://sharepoint.local/sites/listformā. Open the deployed list āSPCustomListFormDemo ā ListInstance1ā

7. In the SPD in the List Settings of āSPCustomListFormDemo ā ListInstance1ā click the Ribbon tab āList Settingsā. Then click āList Formā. You get this dialog:

Enter the name of the new list form, e.g. ānew2.aspxā.
8. In SPD in the List Settings in the āFormsā view you can see your newly created list form.

Select it and open it for edit.
Click āAdvanced Modeā in the Ribbon !!!

Select all the content of the new2.aspx file.
Copy the HTML code.
Open NOTEPAD and paste the HTML code.

9. Go into your project in Visual Studio 2010. There add a new project item of type āApplication Pageā. Name it ānew2.aspxā.

The page will be created in folder āLayoutsSPCustomListFormDemoā

With ādrag & dropā Move the new2.aspx note to your List Definition:

Remove the āLayoutsā folder. You get:

Select ānew2.aspxā in the Solution Explorer and change its property āDeploymentTypeā to āElementFileā

10. In VS2010 open ānew2.aspxā for edit. Delete all content of the file except this two lines:

Replace the āDynamicMasterPageFileā attribute name through āMasterPageFileā. You get:

11. Got to NOTEPAD. Remove the āPageā tag as marked in the screenshow:

Select the rest of the file and copy it to the clipboard.
Now remove the complete content of the āZoneTemplateā node. ā Do not remove the āZoneTemplateā node itself. Now the specific part of ānew2.aspxā looks like this:

(There is a āDataFormWebPartā included in the āZoneTemplateā node. This you remove by following the last step from above. But at runtime SharePoint will create a new DataFormWebPart in the Web Part Zone with ID āMainā. Thatās the reason why we need to remove the copied and pasted Web Parts: Itās one of such a DataFormWebPart too much on the site after SharePoint creates the new one on runtimeā¦)
12. In VS2010 paste the code into ānew2.aspxā
13. Open ānew2.aspx.csā from the Solution Explorer:

Insert this āusingā:

Replace the base type of your class definition from āLayoutsPageBaseā to āWebPartPageā.
14. In the Solution Explorer open āschema.xmlā of your list definition:

Scroll to the bottom of the file and find this part of XML code:

Replace the āSetupPathā attribute of the Form node with type āNewFormā with this value:features$SharePoint.Feature.DeploymentPath$ListDefinition1new2.aspx
You get:

15. Deploy your solution.
16. Go into the browser, reload the list and āadd new itemā.
Now your custom list form will be used!
The URL in the Browser is identically to the first try! Why is it āNewForm.aspxā and not ānew2.aspxā?
-> SharePoint uses āNewForm.aspxā as page for āAdd new itemā but internally redirects to the defined āNew Formā of the list.
You can add some code for demo purpose to help you identifying your custom list form. For that reason I inserted
<h1>Hello World</h1>
into the the ASP Content PlaceHolder āPlaceHolderMainā:

The final result:

Now you can do your own staff on your custom list form.
Part Two Your can check here
Regards
3art Technology Experts
http://www.3art.tech
Comments
Post a Comment