January 20, 2011

Jquery for Hiding/Showing Div tags


var prevTag = null;
var prevAid = null;

function ShowAnswer(id, aID) {
if (document.getElementById(aID).innerHTML == 'View" ) {
document.getElementById(aID).innerHTML = 'Hide" ;
}
else if (document.getElementById(aID).innerHTML == 'Hide') {
document.getElementById(aID).innerHTML = 'View';
}
$("#" + id).show("slow"); //Shows the Tag
if (prevTag == id && prevTag != null) {
$("#" + prevTag).hide("slow"); //Hides the Tag when we click on same div tag for more than 1 time.
prevTag = null;
prevAid = null;
}
else if (prevTag != null) {
if (document.getElementById(prevAid).innerHTML == 'View') {
document.getElementById(prevAid).innerHTML = 'Hide";
}
else if (document.getElementById(prevAid).innerHTML == 'Hide') {
document.getElementById(prevAid).innerHTML = 'View';
}
$("#" + prevTag).hide("slow");
prevTag = id;
prevAid = aID;
}
else {
prevTag = id;
prevAid = aID;
}
}

Code snippet for checking availability of a website/ webservice


private bool WebSiteIsAvailable(string Url)
{
string Message = string.Empty;
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(Url);
request.Method = "GET";
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
// Do nothing; we're only testing to see if we can get the response
}
}
catch (WebException ex)
{
Message += ((Message.Length > 0) ? "\n" : "") + ex.Message;
}
return (Message.Length == 0);
}

Code snippet for Checking Internet Connection in C#

private Boolean fnChkInternetConn()
{
Boolean bol = false;
System.Net.HttpWebRequest objreq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("http://www.google.com");
try
{
System.Net.HttpWebResponse objres = (System.Net.HttpWebResponse)objreq.GetResponse();
objreq.Abort();
if (objres.StatusCode == System.Net.HttpStatusCode.OK)
{
bol = true;
}
}
catch (System.Net.WebException weberrt)
{
bol = false;
}
catch (Exception except)
{
bol = false;
}
return bol;
}

Migrate SharePoint 2010 Infopath to SharePoint Online

 Below are the steps to follow to migrate the Infopath data to SP Online.