Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Archive for July 23rd, 2009

InitializeError- Failed to load the application. It was built with an obsolete version of Silverlight

Posted by ken zheng on July 23, 2009

You may experience this problem when you try to run an existing SilverLight project.

I only know the quick and dirty solution to this problem. (at least, it worked for my app)
You’ll have to open the .xap file with an archive program like winara. Edit the AppManifest.xaml file, and change the version number into the current number (something like 2.0.30825.0). And your program should work.

Posted in Silverlight | Tagged: | Leave a Comment »

Hide left navigation panel without changing Master Page

Posted by ken zheng on July 23, 2009

Just found this easy solution to hide the left navigation panel in sharepoint

The left navigation bar makes the page looks very “SharePoint”. And, some valuable space is wasted under it. If you don’t want to customize the Master page (or want to keep the left nav panel in the rest of the site), you can just hide it on the home page. Insert a Content Editor webpart, and edit the source by clicking the “Source Editor…” button, and enter this:

.ms-navframe{ display:none; }

That’s right, this is just to override the default style for that section.

Posted in Sharepoint | Leave a Comment »

jQuery Ticker for SharePoint Announcement List

Posted by ken zheng on July 23, 2009

By using Scott Price’s code, I add a query to the CAML so it will only display annoucment which not expired.

<script type="text/javascript" src="/Development Library/jquery-1.3.2.min.js"></script>

<script type="text/javascript" src="/Development Library/jquery.newsticker.js"></script>
<script type="text/javascript" src="/Development Library/DateUtilities.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
	var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>";
		soapEnv += "<listName>Announcements</listName>";
		soapEnv += "<query><Query><Where><Geq><FieldRef Name='Expires' /><Value Type='DateTime'><Today/></Value></Geq></Where></Query></query>";
		soapEnv += "<viewFields><ViewFields><FieldRef Name='Title'/><FieldRef Name='Created'/><FieldRef Name='ID'/></ViewFields></viewFields>"; //<RowLimit>1</RowLimit>
		soapEnv += "</GetListItems></soapenv:Body></soapenv:Envelope>";

        $.ajax({
            url: "../_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processResult,
            contentType: "text/xml; charset=\"utf-8\""
        });
    });

function processResult(xData, status) {
        var newnews = $("<ul>").attr("class", "newsticker");
        var rows;
        if (xData.responseXML.getElementsByTagName("z:row").length==0)
        {
			var url = "/test/Lists/Announcements/";
            var liHtml = "<li class='newscontent'> <b> No Latest News <br><br><a href='" + url + "'>Read All"+"</a></b></li>";
            newnews.append(liHtml);
        }
        else
        {
			rows = xData.responseXML.getElementsByTagName("z:row");
			jQuery(rows).each(function() {
            var createdDate= $(this).attr("ows_Created").split(" ");
            var url = "/test/Lists/Announcements/DispForm.aspx?ID=" + $(this).attr("ows_ID");
            createdDate = parseDate(createdDate[0]);
            var liHtml = "<li class='newscontent'>" +  formatDate(createdDate ,'dd MMM yy')+ " - <b>" +  $(this).attr("ows_Title")+ "<br><br><a href='" + url + "'>Read Details"+"</a></b></li>";
            newnews.append(liHtml);
        });
        }

        newnews.appendTo("#tasksUL").newsTicker();
    }
</script>

<style type="text/css">
.newsticker {
list-style-type: none;
height:50px;
color:#336699;
margin-top: 10;
}

.newscontent{
list-style-type: none;
margin-left: 0;
display: inline;

}

.news{
background: url(/_layouts/1033/IMAGES/SIMCENTRAL/link_m.gif) no-repeat  scroll center top;
width:240px;
}

.marktop {
background:transparent url(/_layouts/1033/IMAGES/SIMCENTRAL/link_t.gif) no-repeat scroll center top;
height:11px;

padding:0;
width:240px;
}

.markbottom {
background:transparent url(/_layouts/1033/IMAGES/SIMCENTRAL/link_b.gif) no-repeat scroll center top;
height:11px;
margin-left:0;
padding:0;
width:240px;
}
.markcenter {
height:auto;
margin-top:10;
padding:0;
width:211px;
}
</style>
<div class="markcenter">
<div class="marktop"/>
<div class="news">
<br>
<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Noticeboard</b>
<div id="tasksUL"
</div>
</div>
<div class="markbottom"/>
</div>

Posted in Uncategorized | Tagged: , | 1 Comment »