Kā lietot Resource File SharePoint 2007

Izveidot resursu failu, izmantojot Visual Studio IDE

Kopēt resursu failu 12 strops resurss mape

GetLocalized method from SPUtility to read the values from resource file

Sintakse:

SPUtility.GetLocalizedString(“$Resursi:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, tikai);

Piemērs:

SPUtility.GetLocalizedString(“$Resursi:MyResources,Vārds”, “MyResources”, tikai);

Paraugs Source:

izmantojot System;

izmantojot System.Runtime.InteropServices;

izmantojot System.Web.UI;

izmantojot System.Web.UI.WebControls;

izmantojot System.Web.UI.WebControls.WebParts;

izmantojot System.Xml.Serialization;

izmantojot Microsoft.SharePoint;

izmantojot Microsoft.SharePoint.WebControls;

izmantojot Microsoft.SharePoint.WebPartPages;

izmantojot Microsoft.SharePoint.Utilities;

namespace ResourceFile

{

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


valsts
class
ResourceCollection : System.Web.UI.WebControls.WebParts.WebPart

{


stīgu Vārds;


stīgu Uzvārds;


valsts ResourceCollection()

{

}


protected
override
anulēt CreateChildControls()

{


base.CreateChildControls();


uint lang = SPContext.Current.Web.Language;

FirstName = SPUtility.GetLocalizedString(“$Resursi:MyResources,Vārds”, “MyResources”, tikai);

LastName = SPUtility.GetLocalizedString(“$Resursi:MyResources,Uzvārds”, “MyResources”, tikai);

}


protected
override
anulēt Render(HtmlTextWriter writer)

{

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

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

}

}

}

1 comment to How to Use Resource File in SharePoint 2007

Atstāj atbildi

Jūs varat izmantot šo HTML tagus

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