Using resource files in sharepoint 2010 and visual studio 2010




















You are commenting using your Google account. You are commenting using your Twitter account. You are commenting using your Facebook account. Notify me of new comments via email. Notify me of new posts via email. Email Address:. CarolinePoint Making my point on the internet. Different locations and uses In the AppGobalResources folder of the webapplication in the inetpub Useable from. To do this run: stsadm -o copyappbincontent In the Resouces folder of your feature Usable from your feature feature.

Rate this:. Share this: Twitter Facebook. Like this: Like Loading On the Application tab of the Properties dialog box, enter SharePoint. InterestCalculator as the Assembly name , and enter SharePoint. CustomControls as the Default namespace. Leave the Target framework set to. NET Framework 3.

Click Add. Repeat the previous step to create a second class named InterestCalculatorFieldControl. It also adds the assembly to the manifest and sets it to be deployed to the global assembly cache GAC. This is very similar to the name of the previous file that you created.

The two files have different purposes and are deployed to different folders. Keep them distinct as you work through this article. Add the following statement. This enables your class implementation to reference other classes that you create in later steps. Until you create those classes, you may see compiler warnings about this statement.

Add the following property to the class. This property will be used to set the value from the control editor. Add the following override of FieldRenderingControl to the class. InterestCalculatorFieldControl is a class that you create in a later step. This override illustrates a common pattern for overrides of GetValidatedString Object :.

Overrides of the GetValidatedString Object method check whether the field is required; if it is required, the overridden method throws an SPFieldValidationException exception when the value is null or an empty String.

This exception is caught by the New Item and Edit Item pages if the user tries to save the list item that is being created or edited. In this case, the page remains open, and the Message property of the exception causes an error message to appear underneath the empty field.

Overrides of GetValidatedString throw an SPFieldValidationException exception when the value is not valid, causing an error message to appear underneath the invalid field. Be sure that the class is named InterestCalculatorFieldControl, and change its declaration to specify that it inherits from TextField. Add a protected field for an ASP. NET Label web control that will render the current value of the field in Display mode.

Next add the following override of the DefaultTemplateName property. The String that you are assigning to this property is the ID of a RenderingTemplate object that you will add, in a later step, to the. In a more complex case in which, for example, you have separate templates for the New and Edit modes, you would have to override one or more of the preceding properties in addition to probably the AlternateTemplateName property or the DefaultAlternateTemplateName property.

Add the following override of DisplayTemplateName. Now that you have implemented a simple SharePoint project with a Web Part, it's time to test your work. Ensure that the Visual Studio Output Window is visible.

Watch the progress of the Deploy command in the Output Window. After the Deploy command completes, return to the test site in the browser and refresh the home page. Change the current Web Parts page from design view back to display view to see your Web Part.

Close the browser and return to Visual Studio Open the source file HelloPart. Now, press the F5 key to enter debug mode. Wait until the debugger hits your break point.

Then, step through your code line by line. The SharePoint development tools in Visual Studio provide a much improved development experience for building business solutions in SharePoint Extend the Visual Studio project system to create a special kind of project known as a SharePoint project. Provide project item templates for SharePoint projects that are used to create SharePoint project items. SharePoint Development in Visual Studio.



0コメント

  • 1000 / 1000