0% found this document useful (0 votes)
21 views1 page

LabCodeSnippets Ex2

The document discusses modifying a web part to retrieve a value from the site property bag. It provides code to write a message, get the current web, check if a key exists in the property bag, and if so retrieve and display the value.

Uploaded by

aemopc18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

LabCodeSnippets Ex2

The document discusses modifying a web part to retrieve a value from the site property bag. It provides code to write a message, get the current web, check if a key exists in the property bag, and if so retrieve and display the value.

Uploaded by

aemopc18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

******** Ex 2, Task 1: Modify a web part to retrieve a value from the site property

bag ********
******** Step 5 ********

writer.Write("Please record your expenses in the departmental expenses list.");

SPWeb web = SPContext.Current.Web;


string keyName = "ContosoDepartmentalExpenseTotal";

if(web.Properties[keyName] != null)
{
string expenseTotal = web.Properties[keyName];
writer.Write("<p>Estimated departmental expense total is: " + expenseTotal +
"</p>");
}

You might also like