Sunday, July 11, 2010

Check ASP.NET Page If Valid Using JavaScript

Check ASP.NET Page If Valid (All Validating Form Input Controls Are Valid) Using JavaScript

function ValidatePage() {
if (typeof(Page_ClientValidate) == 'function') {
Page_ClientValidate();
}
if (Page_IsValid) {
//Add Your JavaScript If Page Valid.
document.getElementById('divCaution').style.display = 'none';
}
else {
//Add Your JavaScript If Page Not Valid.
document.getElementById('divCaution').style.display = 'block';
}
}

Saturday, May 30, 2009

Save As Word Document Script

The following JS code will save the inner text of an element like ‹Div id="Save"›, the server must have Microsoft word installed on it and it works only on IE.

function SaveAsWord()
{
var sp = document.getElementById("Save");
var docApp = new ActiveXObject("Word.Application");
var doc = new ActiveXObject("Word.Document");
doc.Application.Visible=false;
doc.Content=sp.innerText;
// Show Save Dialog
doc.Save()
doc.Application.Quit();
}

Add To Favorites Script

function AddToFavorites()
{
var url = document.location.href;

if (window.sidebar)
{
// Mozilla Firefox
window.sidebar.addPanel(document.title, url ,"");
}
else if( window.external )
{
// IE
window.external.AddFavorite(url , document.title);
}
}

Saturday, March 21, 2009

VSeWSS 1.3 (Mar 2009 CTP)

Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3 - Mar 2009 CTP

The tools provide item templates for List Definition, List Definition from Content Type, Content Type, Field Control, Web Part, Module, Root File, Template, Event Receiver, and List Instance. It provides project templates for Team Site Definition, Blank Site Definition, List Definition, Web Part and Empty. It works with Visual Basic .NET and C# languages and a comprehensive user guide is included. It does not include the SharePoint Workflow templates as they are built in with Visual Studio 2008.

Sunday, March 08, 2009

Cross SharePoint Permission When Anonymouse Allowed

When Working With Anonymouse You Some Proplems in Permission The RunWithElevatedPrivileges Method Allow You to Executes a specified Code or method with Full Control rights even if the user does not otherwise have Full Control

SPSecurity.RunWithElevatedPrivileges(delegate()
{

//You Must Create SPSite Object and SPWeb Object Here

// Add Your Code Here Like Add Item to SharePoint List

});