Sunday, July 11, 2010

Execute Java Script Function After AJAX Request

The Follwing JS Code on 'endRequest' Function Will Be Execute After AJAX Request
Ex: After Submitting ASP.NET Form

function pageLoad() {
var manager = Sys.WebForms.PageRequestManager.getInstance();
manager.add_endRequest(endRequest);
}
function endRequest(sender, args) {

//Add Your JS Code Here
window.scrollTo(0, 300);
}

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.