Hvernig á að nota vefsíðuna skrá í SharePoint 2007

Búa Resource skrá með Visual Studio IDE

Afritaðu vefsíðuna skrá inn 12 Hive auðlind mappa

GetLocalized method from SPUtility to read the values from resource file

Setningafræði:

SPUtility.GetLocalizedString(“$Resources:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, aðeins);

Dæmi:

SPUtility.GetLocalizedString(“$Resources:MyResources,FirstName”, “MyResources”, aðeins);

Dæmi Source:

með System;

með System.Runtime.InteropServices;

með System.Web.UI;

með System.Web.UI.WebControls;

með System.Web.UI.WebControls.WebParts;

með System.Xml.Serialization;

með Microsoft.SharePoint;

með Microsoft.SharePoint.WebControls;

með Microsoft.SharePoint.WebPartPages;

með Microsoft.SharePoint.Utilities;

namespace ResourceFile

{

[GUID(“fc643df7-8836-41bf-913f-662ed57e659a”)]


almennings
class
ResourceCollection : System.Web.UI.WebControls.WebParts.Web

{


band FirstName;


band LastName;


almennings ResourceCollection()

{

}


protected
override
ógilt CreateChildControls()

{


base.CreateChildControls();


uint lang = SPContext.Current.Web.Language;

FirstName = SPUtility.GetLocalizedString(“$Resources:MyResources,FirstName”, “MyResources”, aðeins);

LastName = SPUtility.GetLocalizedString(“$Resources:MyResources,LastName”, “MyResources”, aðeins);

}


protected
override
ógilt Render(HtmlTextWriter writer)

{

writer.Write(“Value of First Name from Resource File : “ + FirstName);

writer.Write(“Value of Last Name from Resource File : “ + LastName);

}

}

}

1 comment to How to Use Resource File in SharePoint 2007

Skildu eftir svar

Hægt er að nota þessi HTML tög

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>