Kako uporabljati Resource File v SharePoint 2007

Ustvarite Resource file z Visual Studio IDE

Kopirajte datoteko z viri v 12 panj virov mape

GetLocalized metode iz SPUtility za branje vrednosti iz datoteke vira

Skladnja:

SPUtility.GetLocalizedString(“$Viri:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, dolge);

Primer:

SPUtility.GetLocalizedString(“$Viri:MyResources,FirstName”, “MyResources”, dolge);

Sample Vir:

uporabo System;

uporabo System.Runtime.InteropServices;

uporabo System.Web.UI;

uporabo System.Web.UI.WebControls;

uporabo System.Web.UI.WebControls.WebParts;

uporabo System.Xml.Serialization;

uporabo Microsoft.SharePoint;

uporabo Microsoft.SharePoint.WebControls;

uporabo Microsoft.SharePoint.WebPartPages;

uporabo Microsoft.SharePoint.Utilities;

namespace ResourceFile

{

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


javnih
razred
ResourceCollection : System.Web.UI.WebControls.WebParts.WebPart

{


string FirstName;


string Priimek;


javnih ResourceCollection()

{

}


zaščiteni
preglasijo
neveljaven CreateChildControls()

{


baza.CreateChildControls();


uint lang = SPContext.Current.Web.Language;

FirstName = SPUtility.GetLocalizedString(“$Viri:MyResources,FirstName”, “MyResources”, dolge);

Priimek = SPUtility.GetLocalizedString(“$Viri:MyResources,Priimek”, “MyResources”, dolge);

}


zaščiteni
preglasijo
neveljaven Render(HtmlTextWriter pisatelj)

{

writer.Write(“Vrednost Ime iz Resource File : “ + FirstName);

writer.Write(“Vrednost Priimek iz Resource File : “ + Priimek);

}

}

}

1 comment to How to Use Resource File in SharePoint 2007

Leave a Reply

Lahko uporabite te HTML oznake

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