Loo Resource faili Visual Studio IDE
Kopeeri ressurss faili 12 taru ressurss kausta
GetLocalized meetodi SPUtility lugeda väärtused resssursifail
Süntaks:
SPUtility.GetLocalizedString(“$Ressursid:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, ainult);
Näide:
SPUtility.GetLocalizedString(“$Ressursid:MyResources,Eesnimi”, “MyResources”, ainult);
Proovi Allikas:
kasutamine Süsteem;
kasutamine System.Runtime.InteropServices;
kasutamine System.Web.UI;
kasutamine System.Web.UI.WebControls;
kasutamine System.Web.UI.WebControls.WebParts;
kasutamine System.Xml.Serialization;
kasutamine Microsoft.SharePoint;
kasutamine Microsoft.SharePoint.WebControls;
kasutamine Microsoft.SharePoint.WebPartPages;
kasutamine Microsoft.SharePoint.Utilities;
nimeruumi ResourceFile
{
[Arendus(“fc643df7-8836-41bf-913f-662ed57e659a”)]
avalik
klass
ResourceCollection : System.Web.UI.WebControls.WebParts.WebPart
{
string Eesnimi;
string Perekonnanimi;
avalik ResourceCollection()
{
}
kaitstud
override
tühine CreateChildControls()
{
alus.CreateChildControls();
uint lang = SPContext.Current.Web.Language;
Eesnimi = SPUtility.GetLocalizedString(“$Ressursid:MyResources,Eesnimi”, “MyResources”, ainult);
Perekonnanimi = SPUtility.GetLocalizedString(“$Ressursid:MyResources,Perekonnanimi”, “MyResources”, ainult);
}
kaitstud
override
tühine Muutma(HtmlTextWriter kirjanik)
{
writer.Write(“Väärtus Eesnimi alates ressursifailide : “ + Eesnimi);
writer.Write(“Väärtus Perekonnanimi alates ressursifailide : “ + Perekonnanimi);
}
}
}
Veri nice article. In my blog I have similar article on how to use SPUtility.GetLocalizedString – http://dotnetfollower.com/wordpress/2011/05/the-usage-of-sputility-getlocalizedstring/