Monday, February 8, 2010

System.Web.Silverlight not found

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load file or assembly 'System.Web.Silverlight' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 1: <%@ Page Language="C#" AutoEventWireup="true" %>
Line 2:
Line 3: <%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
Line 4: TagPrefix="asp" %>
Line 5:

Source File: aspx page

** The frustrating part is that you have checked multiple times and ensured that you have System.Web.Silverlight in your assembly and you are pointing to the correct path in the References. So how do you solve this?

According to this forum post, set the property Copy Local = True for the System.Web.Silverlight reference. Although a lot of the users cannot figure out why. Hmmm...

Wednesday, January 27, 2010

Use Javascript to create email

I have a mailto link (using <a />). Upon clicking on that link, I wish to carry out other functions as well (e.g. hide a div, popup a message, etc). The onclick attribute in <a /> does not work properly with the mailto in href.

A solution is to define a Javascript function that handles the mailto inside it.
function Link_OnClickEvent() {
$("#Comment").hide();
window.open("mailto:coded@mail.com", "_blank");
}

Note: You can also use this method if you want to dynamically define the email subject, content or mailto address.

Positioning using CSS and JQuery

Detect browser window size:
  • document.body.clientWidth
Detect screen size: http://www.ilovecolors.com.ar/detect-screen-size-css-style/
  • screen.width (includes scrollbars, etc)
  • screen.height
  • screen.availWidth
  • screen.availHeight

Get position of an object: http://api.jquery.com/position/
  • $(element).position().left
  • $(element).position().top

Tuesday, January 26, 2010

SPAlert

Resources to handle SharePoint Alerts in code.

Wednesday, January 20, 2010

I'm loving JQuery

I would have to admit that when I was given my first Javascript and JQuery task, I had absolutely NO interest or passion in that language due to its unstructured-ness and lack of useful code-writing tools. Note: I came from a Java and .NET background and declaring variables without defining the type (int, string, etc) feels really really strange.

I am currently working on my third JS & JQuery project (I mostly copied codes from the net for my first 2 projects) and I starting to see the LIGHT! The unstructured-ness of things has been clouded by how easy it is to get what I want! Minimal coding/scripting was the highlight of the day!

I am proud to say that I am a JQuery convert and here are some tips to help everyone kickstart their coding-life transformation! :)

Important important reference: http://docs.jquery.com/
Here you'll get all the JQuery APIs properly documented.

To refer to any element in the HTML page (or select them, in JQuery language), use $("#id") where id is the id name of the element. You can also use $(element) which selects all the generic elements in the page. Example: $(a) selects all the <a> in the page! More selectors here. Once you "selected" the element, you can manipulate it easily (attributes, click/hover functions, etc).

Next we have the document ready function.
$(document).ready(function() {
// function code here
});
This function is called when the page is loaded.

and the connection with SharePoint Services. Many thanks to the kind people at Sympraxis Consulting LLC that made SP Programming much simpler and light-weighted!


Tuesday, January 19, 2010

Modify EditForm.aspx in SharePoint

Here's a neat trick to make modifications to the aspx page without going through SharePoint Designer.

Add this query string/param to the EditForm.aspx url (obtainable by clicking on any ListItem and the clicking Edit): ToolPaneView=2

The "Add Web Parts" toolbar appears!

Wednesday, January 13, 2010

JQuery Documentation

http://jquery.com/

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.