Monday, October 20, 2008

401 Unauthorized, WebServices, Sharepoint

SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(web.Site.ID))
{
// do things assuming the permission of the "system account"
}
});

Wednesday, October 15, 2008

Show/Hide control

control.style.display = 'block'; //show
control.style.display = 'none'; //hide

Set event onchange in JavaScript

document.getElementById("something").onchange = function(){hideFields()}

Javascript get dropdownlist Label value?

<select name="menu" id="menu"><option value="1">label 1</option><option value="2">label 2</option></select>

<button onclick="'show()'">Click me</button>

<script type="text/javascript"><br />function show(){<br />var theContents = document.getElementById('menu')[document.getElementById('menu').selectedIndex].innerHTML;<br />window.alert(theContents);<br />}<br /></script>

Friday, October 10, 2008

Access WebParts maintaince page

Append the querystring ?contents=1 

Wednesday, October 8, 2008

Speed Dial Tweaks In Opera: create more speed dial tabs

1. In opera address field type: opera:config

2. At the top is field for search. Type speed

3. Under "User Prefs" find "Speed Dial File" (speeddial.ini file location)

4. Go to that location and open file speeddial.ini for edit.

5. At top add:

[Size]
Rows=3
Columns=5

Tuesday, October 7, 2008

Code blocks are not allowed in this file

Whenever I start a new SharePoint project and put server side code in the master page I get this error. The fix to this is quite easy, all you need to do is locate the <pageparserpaths> </pageparserpaths> tags and put the following inbetween:

 <pageparserpath virtualpath="/_catalogs/masterpage/MyMasterPage.Master" compilationmode="Always" allowserversidescript="true">