LoGanathan
I am LoGanathan. I am a Software professional. I write here on the technologies that I like, learn and use.
Thursday, 24 January 2013
Wednesday, 16 January 2013
Posted by Logu on 01:59 with No comments
There’s a couple of exceptions to look out for when you start developing custom ASP.NET Ajax client controls. They are:
These errors can be caused when you have a custom control/component which gets added and then re-added at some later point in time – such as when you have a partial page render. This is being caused because the Sys.Control or Sys.Component gets registered with the Sys.Application when you call the initialize method of your component like so:
Under the hood, the Sys.Application keeps a list of all the components that are registered with it – that’s how $find works. So when you call ‘initialize’, Sys.Application looks at the list of components that it currently knows about and if yours already exists then you will likely see one of the errors listed above.
The trick is to make sure that you call dispose on your control’s base when you are finished:
Microsoft JScript runtime error: Sys.InvalidOperationException: Two components with the same id ‘ctl00_MainContentPlaceHolder__eventsRepeater_ctl01_ke1′ can’t be added to the application.
and…
Microsoft JScript runtime error: Sys.InvalidOperationException: A control is already associated with the element.
These errors can be caused when you have a custom control/component which gets added and then re-added at some later point in time – such as when you have a partial page render. This is being caused because the Sys.Control or Sys.Component gets registered with the Sys.Application when you call the initialize method of your component like so:
MarkItUp.Web.MyCustomControl.callBaseMethod(this, ‘initialize’) ;
Under the hood, the Sys.Application keeps a list of all the components that are registered with it – that’s how $find works. So when you call ‘initialize’, Sys.Application looks at the list of components that it currently knows about and if yours already exists then you will likely see one of the errors listed above.
The trick is to make sure that you call dispose on your control’s base when you are finished:
dispose : function() {
$clearHandlers(this.get_element()) ;
// any other cleanup work
MarkItUp.Web.MyCustomControl.callBaseMethod(this, ‘dispose’) ;
}
Friday, 11 January 2013
Posted by Logu on 02:40 with No comments
looks at the
<system.web> section of Web.config instead of the <system.webServer> section (which is used by IIS7, unless it's running in compatibility mode). To render this meta tag on every page of your site when running IIS6, I believe the best option is to add it to your MasterPage. I ended up adding the following code block to the OnPreRender event of my MasterPage:Page.Header.Controls.AddAt(0, new HtmlMeta { HttpEquiv = "X-UA-Compatible", Content = "IE=EmulateIE7" });The reason I used AddAt instead of just plain Add is because the X-UA-Compatible meta tag apparently has to be the first thing in the page header in order for it to be respected.
Hope this helps someone in the same boat!
Categories: .Net
Monday, 3 December 2012
Posted by Logu on 03:40 with No comments
I have created a team calendar mainly to share meetings, travels and vacations plans. Because I also wanted to manage differently those event types, I have created a Category for each of them.
· Meeting
· Holiday
· Travel
· Other
Here is my calendar with some information.
Click on the image to zoom
Because I think that color coding would help to easily identify event categories, I have created the following custom view (note that I have chosen not to display start and end time).
Here is the procedure to customize your calendar to be color coded.
Step 1: Create a new column [Color]. This will be used to define the color of the cell based on the category.
On the list settings page, click on Create Colum link. Name the new column “Color”, and set the type of information as Calculated (calculation based on other columns).
The formula is the following:
Finally, set The data type returned from this formula is: to Single line of text. =IF([Category]="","LightCyan",IF([Category]="Meeting","DodgerBlue",IF([Category]="Holiday","Tomato",IF([Category]="Travel","LawnGreen",IF([Category]="Other","DarkBlue","")))))
The result of this column will be a color name based on a category. Note that category should reflect ones you choose and color names can be changed.
Step 2: Create a new column [EventText]. This will contains the html code that will display the event text on the calendar view (including the color scheme).
As above, create a new calculated column with the following formula:
="<span style='position:relative;display:inline-block;width:100%;'><span style='width:100%;display:inline-block;text-align:center;border:1px solid "&[Color]&";position:absolute;color:"&[Color]&";'>"&[Title]&"</span><span style='display:inline-block;width: 100%;background-color:"&[Color]&";text-align:center;border:1px solid;z-index:-1;filter:alpha(opacity=20);opacity:0.2;'>"&[Title]&"</span></span>"
Note that we used the previously calculated column [Color] to define the cell color, and we also use column [Title] to display the event title inside the cell (you can also display Start Time and End Time if requested).
This is up to you to define your own style, this is simply html syntax.
This is up to you to define your own style, this is simply html syntax.
Step 3: Define [EventText] column as the display on the calendar view.
You now need to create a new view for this calendar. This new view should be a Standard Calendar format view. Define properties as you wish. The important part is to display our newly created column [EventText] to replace the default Title.
Let’s now save the view and check the result.
Not so good isn’t itL. It displays the html code instead of interpreting it. To solve this, we need to insert JavaScript code into the page.
Here is the JavaScript code (such kind of code can be found in MSDN web site or in some blogs like techtrainingnotes.blogspot.com).
// Color coded calendars for SharePoint 2010<script>// TechTrainingNotes.blogspot.com// load our function to the delayed load list_spBodyOnLoadFunctionNames.push('colorCalendarEventLinkIntercept');// hook into the existing SharePoint calendar load functionfunction colorCalendarEventLinkIntercept(){if (SP.UI.ApplicationPages.CalendarNotify.$4a){var OldCalendarNotify =SP.UI.ApplicationPages.CalendarNotify.$4a;SP.UI.ApplicationPages.CalendarNotify.$4a = function (){OldCalendarNotify();colorCalendarEventLinks();}}if (SP.UI.ApplicationPages.CalendarNotify.$4b){var OldCalendarNotify =SP.UI.ApplicationPages.CalendarNotify.$4b;SP.UI.ApplicationPages.CalendarNotify.$4b = function (){OldCalendarNotify();colorCalendarEventLinks();}}// future service pack change may go here!// if (SP.UI.ApplicationPages.CalendarNotify.???)}// hide the hyperlinksfunction colorCalendarEventLinks(){// find all DIVsvar divs = document.getElementsByTagName("DIV");for (var i=0;i<divs.length;i++){// find calendar item DIVsif (divs[i].className.toLowerCase()=="ms-acal-item"){divs[i].innerHTML = divs[i].innerHTML.replace(/</g,'<').replace(/>/g,'>');}// find "x more items" links and re-remove links on Expand/Contractif (divs[i].className.toLowerCase()=="ms-acal-ctrlitem"){var links = divs[i].getElementsByTagName("A");if (links.length==1){links[0].href="javascript:colorCalendarEventLinks();void(0);"}}}}</script>
To include the code into the page, there are 2 solutions:On SharePoint Designer, open your SharePoint site. On the left menu, select Lists and Libraries, then click on your Calendar name on the main screen. Right Click on the view you want to color code (or create a new one first) and select Edit File in Advanced Mode.
· Using SharePoint Designer, the JavaScript code will be added to the page code directly
· Using Content Editor Web Part, the JavaScript code is embed in a WebPart.
Using SharePoint Designer
Identify the section below to copy your JavaScript code inside
Save and check the result.
You can choose to leave items like this or modify CSS styles to remove the green box around your events.
Search the section <style type="text/css"> and replace with this:
<style type="text/css">.ms-acal-time {display:none;}.ms-acal-selected, .ms-acal-item {background:none;border:0px;}.ms-acal-sdiv span {margin-left:-47px;}.ms-acal-sdiv div.ms-acal-title span {margin-left:0px;}</style>
Save and check the result. Now we have the expected result J.
Using Content Editor Web Part
First of all, the script above should be saved into a txt document and uploaded in one of your site library.
On your custom Calendar View, select Edit page on the Site Actions menu.
Add a Content Editor Web part to Main section; this web part is located under Media and Content category. Edit the web part. Set ContentLink to your script document’s URL andChrome type to None (this will remove web part title and borders)
Save and check the result.
The drawback of this solution is that you will not be able to select other views for this calendar,
where with the SharePoint Designer method, all views are still accessible.
Because of this I prefer to use the using the Contant Editor webpart.
Result was like that.
if we have to remove the time in events mean
using this css
Categories: WebParts
Wednesday, 28 November 2012
Posted by Logu on 04:30 with No comments
In this article,how we can use the Ajax Control Toolkit in Sharepoint 2010.using this sharepoint designer and Visuval studio.
1.Download the Ajax Control Toolkit from this url Click here.
2.Add Ajax Control Toolkit ScriptManager in your master page.Open the Master page in SharePoint Designer.
Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %
- First register the Ajax Control Toolkit namespace in the masterpage file by putting the following line at the top of the file
Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %
- Then remove the ScriptManager registration from the master page by removing the following line:
<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false"
EnablePartialRendering="true" EnableScriptGlobalization="false"
EnableScriptLocalization="true"/>
- Finally Add the following line in place of the above line to register Ajax Control Toolkit
<ajaxToolkit:ToolkitScriptManager id="ScriptManager" runat="server" EnablePageMethods="false"
EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true"/>
3.Register Ajax Control Toolkit namespaces in SharePoint package Designer
First open the Package designer in Visual Studio (Package usually exists under Package folder in Visual Studio). And then click the “Advanced” button in package designer window as shown in the image below. In that advanced tab you can add/edit assemblies to be registered safe as part of the deployment of the solution package. Click Add ==> “Add Existing Assembly”. The following image shows wizard to follow.
Figure 1: Package Designer’s Advance tab
In the “Add existing Assembly” window, add the following namespaces for Ajax Control Toolkit.
The following image shows the “Add Existing Assembly” window for AjaxControlToolkit dll.
Figure 2: Add/Edit Existing Assembly window
Now you can build and deploy the package and as a result of deployment, Ajax Control Toolkit namespaces will be registered as safe controls in web.config.
Categories: Ajax
Posted by Logu on 03:04 with No comments
Adding a new menu item to the SharePoint welcome/user menu is fairly straight forward.
Thanks to Sohels blog for pointing me in the right direction.
First create a new empty SharePoint project in Visual Studio 2010, call it "MenuItemProject".

Deploy as a farm solution and click finish.

Add a feature to the project. In the solutions explorer box, right click on the feature node and add feature.

Also in the solution explorer, right click the top menuItemProject node and add > new item.

Add an empty Element called "MenuAdditionElement".

Once added, open the menuAdditionElement > Elements.xml file.

Replace the Elements.xml code with the following:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="myCustomAction"
GroupId="PersonalActions"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1000"
Title="Google"
Description="Search away">
<UrlAction Url="http://www.google.com"/>
</CustomAction>
</Elements>
Save the Elements.xml file and then in the solutions explorer double click on the feature1.feature node.

Ensure the MenuAddition Element is included in the items in the feature.

Deploy the solution to your SharePoint server.
Once deployed, refresh your site home page and the new menu item should be visible.
Categories: Programming
Wednesday, 7 November 2012
Posted by Logu on 22:04 with No comments
First step from the site actions drop down choose view all site content on the blogsite
And choose list from the ribbon and goto the List permissions as shown below
You will then need to stop inheriting permissions for this list,
Once you have broken inheritance your view on the ribbon will change as illustrated below you will need to click on anonymous access
Once clicked you will be presented with the dialogue box below you will have to change the settings to allow Add Items – Add items to lists this will enable your readers to post comments on your new shiny SharePoint Blog.
Click on the comments list
And choose list from the ribbon and goto the List permissions as shown below
Once you have broken inheritance your view on the ribbon will change as illustrated below you will need to click on anonymous access
Once clicked you will be presented with the dialogue box below you will have to change the settings to allow Add Items – Add items to lists this will enable your readers to post comments on your new shiny SharePoint Blog.
Categories: Enable Features
Search
About Me
Categories
Blog Archive
Popular Posts
-
I have created a team calendar mainly to share meetings, travels and vacations plans. Because I also wanted to manage differently those eve...
-
Create a folder in your C drive called backup. Then give the path as C:\backup This will save the backup file in c:\backup folder You dont h...
-
This slide show web part displays the images with it's original size. Due to this the web part changes its size according to the image s...
-
In this article,how we can use the Ajax Control Toolkit in Sharepoint 2010.using this sharepoint designer and Visuval studio. 1.Download the...
-
PowerShell command are, Backup a Site Collection with PowerShell command Backup-SPSite -Identity http://myserver -Path "c:\......bak...
-
However when we try to add conditions for formatting I cannot add more than 5 Conditions? How can this be overcome? Yo...
-
The picture library webpart uses the css classes in corev4.css in sharepoint 2010. The web part uses “ .ms-WPBody ” css class for styling. I...
-
First step from the site actions drop down choose view all site content on the blogsite Click on the comments list And choose list from ...
-
There’s a couple of exceptions to look out for when you start developing custom ASP.NET Ajax client controls. They are: Microsoft JScript r...
-
Adding a new menu item to the SharePoint welcome/user menu is fairly straight forward. Thanks to Sohels blog for pointing me in the right di...














