Yuav siv cov kev pab cov ntaub ntawv hauv SharePoint 2007

Tsim Resource ntaub ntawv siv siv qhov muag saib Studio IDE

Luam tau cov chaw muab kev qhia ntawv rau hauv 12 nas muv nplaub tshev qho

GetLocalized txoj kev ntawm SPUtility mus nyeem rau qhov tseem ceeb ntawm cov chaw muab kev qhia ntaub ntawv

Syntax:

SPUtility.GetLocalizedString(“$Kev pab:<<ResourceFileName,ResourceKeyName>>”, “<<ResourceFileName>>”, lang);

Piv txwv:

SPUtility.GetLocalizedString(“$Kev pab:MyResources,FirstName”, “MyResources”, lang);

Coj mus kuaj tau qhov twg los:

siv Tsim;

siv System.Runtime.InteropServices;

siv System.Web.UI;

siv System.Web.UI.WebControls;

siv System.Web.UI.WebControls.WebParts;

siv System.Xml.Serialization;

siv Microsoft.SharePoint;

siv Microsoft.SharePoint.WebControls;

siv Microsoft.SharePoint.WebPartPages;

siv Microsoft.SharePoint.Utilities;

namespace ResourceFile

{

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


pej xeem
hoob
ResourceCollection : System.Web.UI.WebControls.WebParts.WebPart

{


hlua FirstName;


hlua LastName;


pej xeem ResourceCollection()

{

}


kev tiv thaiv
override
khoob lug CreateChildControls()

{


puag.CreateChildControls();


uint lang = SPContext.Current.Web.Language;

FirstName = SPUtility.GetLocalizedString(“$Kev pab:MyResources,FirstName”, “MyResources”, lang);

LastName = SPUtility.GetLocalizedString(“$Kev pab:MyResources,LastName”, “MyResources”, lang);

}


kev tiv thaiv
override
khoob lug Kav(HtmlTextWriter kws ntawv)

{

txawj sau ntawv.Sau ntawv(“Tus nqi ntawm lub npe ntawm tus thov kev pab : “ + FirstName);

txawj sau ntawv.Sau ntawv(“Tus nqi ntawm lub xeem los ntawm cov chaw muab kev qhia ntawv : “ + LastName);

}

}

}

1 kev qhia kom paub siv kev pab cov ntaub ntawv nyob rau hauv SharePoint 2007

sau ntawv cia

Koj siv tau qhov cim npe no HTML

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