Skip to main content

Blog de Daniel Alonso

Go Search
Home
  

Other Blogs
There are no items in this list.
Unable to update the dependencies of the project Visual Studio 2005

Seems like Microsoft Visual Studio 2003 and 2005 has some major problems with the dependencies in a setup project. Later this week I tried to compile the setup project that's in a solution with multiple other projects and out came this: "ERROR: Unable to update the dependencies of the project.  The dependencies for the object 'xxxx.dll' cannot be determined." When you right click Refresh Dependencies on the Detect Dependencies you will get another error message: "The operation could not be completed" from Microsoft Visual Studio.

 

I've been researching a lot and came to this conclusion. When you make major changes to your solution like adding modules, increasing version number, the project seems to lose all dependencies with the .dll files. At this point there is not much to do. There are some workarounds but their success is not guaranteed. There is a workaround that makes sense and worked fine for me and it's always better then deleting the setup project and redoing it.

So for the workaround you need to follow these steps:

  • Mark the assemblies that fail to update their references.
  • Close VS2005.
  • Open the setup project file (.vdproj file) with a text editor.
  • Locate the "File" section.
  • Locate and remove the assembly references from step 1.
    • These references start with a GUID reference like :"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_0FE46745DE13D177CF253E35E33B9B04",  and end with something like this:"IsolateTo" = "8:"
  • Save the file
  • Open VS2005 and rebuild.

   

Sample file (red lines should be removed)

 "File"
        {

            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0C0430E641F4445D9516B2CD0DF6D372"
            {
            "SourcePath" = "8:..\\Setup\\CabArc.Exe"
            "TargetName" = "8:CabArc.Exe"
            "Tag" = "8:"
            "Folder" = "8:_2F74E0FB53014DC3862F7F3DF19CC5F5"
            "Condition" = "8:SETUP_CLIENT=1"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_0FE46745DE13D177CF253E35E33B9B04"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_0FE46745DE13D177CF253E35E33B9B04"
                    {
                    "Name" = "8:Microsoft.Practices.EnterpriseLibrary.Logging.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.Practices.EnterpriseLibrary.Logging.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_E58FBD674227478D90C4056AD8242BCF"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
           }

I've got this work around from Chris Mylonas and as I said it worked fine for me.

 

Here are more workaround's and discussions about this problem:

http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/83e136a2-a93f-4abb-8bf9-ba6eafba5a2c

 

And here are some official statements from Microsoft about this bug.

http://support.microsoft.com/kb/917036

 

Welcome to my blog!

Hi every one, this is my blog. I'm a trainee, still in the university busy studying Computer Science and working after hours. I'm no genus (not yet ;)) so everything I find interesting while I'm at work I will post in this blog, many things will be from other sites because I was googleing for them. So don't be surprised to find some links to the original pages where I found the information J. I hope my blog can helps you in some way. Have fun coding!

Add Custom Table Formats to SharePoint Content Editor

When editing content a SharePoint Publishing site, you can select from 5 predefined table formats when inserting a table. The image on the left lists the table formats available to select from. Although the table formats are worth consideration, they may not match the unique fonts, colors, and other branding defined elsewhere within your web site.

You have 2 choices when deciding how to integrate your own CSS-based custom table formats: you can replace the predefined formats with your own style definitions, or you can add to the list of predefined formats that ships with SharePoint. Whichever approach you decide to take, both require looking at the predefined formats that ship with SharePoint and using those as a basis for your new style definitions.

Create Your Custom Table Format Style Definitions

To define the new table formats it's easiest to start by working from the style definitions of the SharePoint predefined formats.  Fire up your favorite CSS editor (I recommend Visual Studio or Notepad++) and open the file:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\STYLES\HtmlEditorTableFormats.css

Read through the file and notice how it's a series of repeating style definitions with a repeated prefix pattern of .ms-rteTable-TABLE_FORMAT_NAME, where TABLE_FORMAT_NAME is the text displayed in the predefined table format list shown above. Currently the TABLE_FORMAT_NAMES are all integers. However you are not restricted to using just numbers when you create your own formats.

Now that you can see how the styles are defined, create a temporary CSS file and copy-paste the CSS statements for one of the existing table formats into your temporary file, and replace all instances of the string TABLE_FORMAT_NAME with your own table name and save the file. Make sure there are no spaces or special characters in the TABLE_FORMAT_NAME and that all styles have been accounted for.

Approach 1 – Replace the Predefined Formats with Custom Style Definitions

Add your custom style definitions to one of your site CSS files to replace the table definitions provided by SharePoint. For more detail on the inner-workings of this approach, refer to this Microsoft article (scroll down to the sub-heading: Predefined Table Formats).

Approach 2 – Add to the List of Predefined Formats that Ships with SharePoint

To add your styles to the list provided by SharePoint, you will need write access to the file system on the SharePoint server. As with any modification of SharePoint files, you should make backups, store them in source control, and test all changes on a pre-production server before moving into your live environment. Simply paste your style definitions to the end of the file we started from earlier in the article and save the file:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\STYLES\HtmlEditorTableFormats.css

Create a New Table with Your Custom Style Definitions

Regardless of the approach used, you should now be able to create a new new table in a page and your new table format should appear (you may need to restart IIS and/or flush the cache in your web browser). If you followed Approach 1, your format will be the only item in the list. If you followed Approach 2, your item will appear at the end of list after the SharePoint predefined formats.

Source: http://mikeknowles.com/blog/2009/01/20/AddCustomTableFormatsToSharePointContentEditor.aspx

How to inherit form a class 2 levels below

How to inherit form a class 2 levels below. Lets say you have this 2 CSS classes:

.Style1

{

    Font-size:11px;

}

.Style2

{

    Font-size:15px;

}

 

Now let's say you can only overwrite "Style2" and not modify it, and you need the font size to be whatever is underneath "Style2" like for example "Style1". This can be done with this Style

.Style3

{

    Font-size:100%

}

IE and Firefox's render will notice that the font size has changed and must be over written so you now have instead of "Style2" "Style3", and because the font size is set to 100% the value you obtain is 11px from the Style1 and not 15px form Style2. You would obtain 15px if you had this style:

.Style3

{

    Font-size:inherit;

}

Create a SharePoint Minimal or Base Master Page

How to: Create a Minimal Master Page

One of the first tasks that you must complete when configuring a Microsoft Office SharePoint Server 2007 Web site is to create one or more master pages. A master page contains references to elements that you can share across multiple pages in an Office SharePoint Server 2007 site, such as navigation, search controls, logon controls, and banner images. A master page can also contain the cascading style sheet (CSS) and ECMAScript (JScript, JavaScript) references that define the overall look and feel of your site. Commonly, every site—and therefore every page—in your site collection uses the same master page to present a consistent user experience across the entire site collection. Depending on your needs, you can use a different master page for one or for all of the sites in your site hierarchy to distinguish the various areas of your portal.

Master Page Galleries

When you provision a site collection in Office SharePoint Server 2007, the system creates a master page gallery that contains all the master pages and page layouts for that site collection. If the site collection uses either the Publishing Portal or Collaboration Portal templates, the master page gallery includes several master pages that are provided with Office SharePoint Server 2007, such as BlueBand.master. These master pages are located in the path "C:\Program%20Files\Common%20Files\Microsoft%20Shared\web%20server%20extensions\12\TEMPLATE\FEATURES\PublishingLayouts\MasterPages\", with other example .master pages. You can use any of these master pages as they are, or you can customize them fully to create unique branding for your site.

 

To create a minimal master page

  1. Open SharePoint Designer.
  2. On the File menu, click New, point to SharePoint Content, and then click the Page tab.
  3. Double-click Master Page to create a new master page.
  4. Click Design to show the master page in design view. You should see header and left margin areas and several content placeholders in the master page.
  5. Click Code to show the master page in code view.
  6. Copy the following code into the master page.

<---CODE:--->

<%-- Identifies this page as a .master page written in Microsoft Visual C# and registers tag prefixes, namespaces, assemblies, and controls. --%>

<%@ Master language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ Import Namespace="Microsoft.SharePoint" %>

<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %>

<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %>

<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %>

<%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %>

<%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %>

<%-- Uses the Microsoft Office namespace and schema. --%>

<html>

<WebPartPages:SPWebPartManager runat="server"/>

<SharePoint:RobotsMetaTag runat="server"/>

 

<%-- The head section includes a content placeholder for the page title and links to CSS and ECMAScript (JScript, JavaScript) files that run on the server. --%>

<head runat="server">

<asp:ContentPlaceHolder runat="server" id="head">

<title>

<asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />

</title>

</asp:ContentPlaceHolder>

<Sharepoint:CssLink runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />

</head>

 

<%-- When loading the body of the .master page, SharePoint Server 2007 also loads the SpBodyOnLoadWrapper class. This class handles .js calls for the master page. --%>

<body onload="javascript:_spBodyOnLoadWrapper();">

<%-- The SPWebPartManager manages all of the Web part controls, functionality, and events that occur on a Web page. --%>

<form runat="server" onsubmit="return _spFormOnSubmitWrapper();">

<wssuc:Welcome id="explitLogout" runat="server"/>

<PublishingSiteAction:SiteActionMenu runat="server"/>

<PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server">

<PublishingConsole:Console runat="server" />

</PublishingWebControls:AuthoringContainer>

<%-- The PlaceHolderMain content placeholder defines where to place the page content for all the content from the page layout. The page layout can overwrite any content placeholder from the master page. Example: The PlaceHolderLeftNavBar can overwrite the left navigation bar. --%>

<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />

<asp:Panel visible="false" runat="server">

<%-- These ContentPlaceHolders ensure all default SharePoint Server pages render with this master page. If the system master page is set to any default master page, the only content placeholders required are those that are overridden by your page layouts. --%>

<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/>

<asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/>

<asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/>

<asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/>

<asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/>

<asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/>

<asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" />

<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/>

<asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/>

<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat ="server"/>

<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat ="server"/>

<asp:ContentPlaceHolder id="PlaceHolderBodyRightMargin" runat="server" />

</asp:Panel>

</form>

</body>

</html><---End Code--->

  1. On the File menu, click Save As, provide a unique file name with the .master extension, and then save the file to the master page gallery (/_catalogs/masterpage) in your site-collection.

Source: MSDN

Here is a link to Heather Solomon's web page where she added some basic Master Pages made by her.

Changing style Content Query Web Part

This is a quick guide in how to make few changes to your Content Query Web Part using CSS Style Sheets only. Actually the changes we are about to do also affect also other web parts, so be careful.


Changing the CSS styles from your page is easily done with the SharePoint designer, I'll be adding a post about how to use SharePoint designer in a near future. Once you located the CSS Style Sheet that your page is using, simply overwrite the following classes to adjust your web parts to the general look and feel of the page. Let us begin having a closer look to the alternating colors used by the CQWP.

Note: it's possible that some styles do not work with differed browsers, try to adjust them using developer's tools like firebug for Firefox. Also note that I'm using the Enhanced Content Query Web Part but that doesn't make a difference to what we are doing now.

Well it looks kind of nice, but it could not fit to your page layout. So let's do some changes. Changing the alternating colors, overwrite in your CSS this class and ad for example this value:

.ms-alternating /*Changes the alternating color */

{

background-color:#FFFFCC;

}

Because this was too easy lets change some more classes and see what happens.

.ms-WPBody A:link,.ms-WPBody A:visited /*Changes the color of the text inside the alternating table */

{

color:#003399;

}

.ms-vh,.ms-vh2,.ms-vh-icon,.ms-vh2-nofilter,.ms-vh2-nofilter-icon,.ms-viewheadertr .ms-vh-group,.ms-vh2-nograd,.ms-vh2-nograd-icon /* Changes the title background */

{

background-color:#FFEA6F;

}

We only changed 3 classes and have a whole new look. Now the next problem is the context menu. It still has the old style and doesn't fit any more. Here's a trick. The blue bar you see underneath the icons actually is a 26x1 pixel blue image. So create and store an image that is exactly 26 pixels wide and 1 pixel high and color it with some nice yellow, save it to your desktop.

 

So create and store an image that is exactly 26 pixels wide and 1 pixel high and color it with some nice yellow. Now the only thing you have to do is to overwrite this class:

.ms-MenuUI

{

background-image:url('MenuUI.gif');

}

Specify the URL of the picture you crated on your desktop instead of 'MenuUI.gif', and voila:

Note: If you want to change some other things from the context menu, here's a tip how to view the html of the context menu with firebug or another developer tool that handles and debugs scripts. Go to the script tag and enter a new expression to the observation window (this is how it works in firefox). Search for the function "CrateMenuEx". Now put a brakepoint at the end of this function. Click on a line that generates the context menu, now you will see that the script has come to a halt and you can now see all the styles used with your html tab.

Now one more thing, change the ".ms-selectedtitlealternative" to customize the border when you select a document.

.ms-selectedtitlealternative

{

border:1px solid #FFCC66;

}

The end result should look something like this:

 

Try experimenting with the firebug tool to figure out more classes you can change.

Costumize WepPart title Containers

Depending on the customization method you selected (CSS, Theme or Master Page), at this point you have probably managed to alter parts of your SharePoint site. This part of the article series will focus on how to change the look and feel of SharePoint components that you don't necessarily have direct or ultimate control over.

A lot of SharePoint functionality is created using server and user controls. In the master page, the bit of SharePoint functionality is created with a single tag. This tag has a matching page directive, and that directive specifies which source file should be used to create the meat behind the control.   A lot of these source files are locked down, you can't access them and modify their properties, functionality, and what we are concerned with, their user interface. Some examples of this is Search, Site Actions menu, Quick Launch and the Publishing Console. 

   

So instead you are left with taking what has been created for you, and adding style changes to alter the final look and feel. In some instances, you can also control and add some properties to the control tag itself. This article walks through some common SharePoint items and how you can alter their appearance using what has been given to you by SharePoint.

   

Web Parts

Web Parts are actually relatively easy to change. There are a few styles that control the header, and a few that control the body. Note that the web parts are rendered into tables, and usually nested tables. So you will be working with table rows and table cell tags and styles primarily.

   

See a more complete list of Web Part styles in the CSS Reference Chart.

   

The Web Part Title Bar

Relatively speaking, there are not a lot of styles used in a web part title bar. There is one style for the container (ms-WPHeader), and one style for the text (ms-WPTitle). Here are the default styles from Core.CSS. You can copy these styles and then make changes to modify the Web Part title bar look and feel.

   

.ms-WPHeader TD {

border-bottom:1px solid #4e7cb7;

border-collapse:collapse;

}

   

.ms-WPTitle {

font-weight:bold;

color:#4c4c4c;

padding-left:3px;

padding-right:7px;

padding-top:2px;

padding-bottom:2px;

font-size:10pt;

}

.ms-WPTitle A:link,.ms-WPTitle A:visited {

color:#4c4c4c;

text-decoration:none;

cursor:pointer;

}

.ms-WPTitle A:hover {

color:#000000;

text-decoration:underline;

cursor:pointer;

}

   

If you want to use an image in your header bar, add a background property to ms-WPHeader, such as:

.ms-WPHeader TD {

Background: rgb(226,139,169) url("/images/myimage.gif") repeat-x;

}

   

If you want to alter the title text, be sure to update ms-WPTitle, and the following instance that includes hyperlinks. Not all web part titles are links (and vice versa) so you will need to edit both styles, or do it in a single style like this:

.ms-WPTitle, .ms-WPTitle A:link,.ms-WPTitle A:visited {

Color: black;

Font-size: 1.5em

}

   

   

Rounded Corners in the Web Part Title Bar

A common request is to create rounded corners for the web part title bar. You can do this using the CSS sliding doors technique. You will need to create 2-3 images, depending on what your design looks like. If you want a solid background, then you only need two images. If you have a gradated background or some other type of image, then you will need three images.

   

   

The sliding doors technique applies one image of a rounded corner to the far right of the background of a parent container, then one image of a rounded corner to the far left of a child container within the parent.

   

When you look at the rendered code of a web part, the web part uses a table and several nested tags to create the title bar:

   

<td>

        <table border="0" cellpadding="0" cellspacing="0" width="100%">

             <tr class="ms-WPHeader">

<td title="I need to... - Displays tasks and tools from a list" id="WebPartTitleWPQ3" style="width:100%;"><h3 class="ms-standardheader ms-WPTitle"><nobr><span>I need to...</span><span id="WebPartCaptionWPQ3"></span></nobr></h3></td> 

<td align="right" style="padding-right:2px"><div style="cursor: pointer" class="ms-HoverCellInActive" onmouseout="this.className='ms-HoverCellInActive'" onmouseover="this.className='ms-HoverCellActiveDark'"><nobr><a onclick="MSOWebPartPage_OpenMenu(MSOMenu_WebPartMenu, this, WebPartWPQ3,&#39;False&#39;);return false;" id="WebPartWPQ3_MenuLink" onkeydown="MSOMenu_KeyboardClick(WebPartWPQ3_MenuLink, 13, 40)" href="#"><img src="/_layouts/images/Menu1.gif" border="0" align="absmiddle" title="I need to... Web Part Menu" alt="I need to... Web Part Menu" style="padding-left:2px;" /></a></nobr></div></td>

                </tr>

        </table>

</td>

   

   

For SharePoint, the table cell will be the parent, and the H3 tag inside the table cell will be the child. We will use the table row class as a selector to target these changes to web parts, and not all tables in the site. Here is the CSS for a solid bar. Notice the right image in the first style and the left image in the second style.

   

.ms-WPHeader td {

background: rgb(242,181,15) url('/images/wpright.gif') no-repeat top right;

margin: 0;

padding: 0;

height: 31px

}

.ms-WPHeader TD h3 {

background: url('/images/wpleft.gif') no-repeat top left;

margin: 0;

padding: 7px 7px 0px 25px;

height: 24px;

font-size: 1.2em;

color: white

}

.ms-WPHeader TD h3 a:link, .ms-WPHeader TD h3 a:visited {

color: white

}

   

And here is the result:

   

   

As you can see, there is still a problem with the edit menu to the far right. The CSS can be adjusted to specify that only the first table cell should have the background by adding a first-child pseudo-class:

   

.ms-WPHeader td:first-child {

background: rgb(242,181,15) url('/images/wpright.gif') no-repeat top right;

margin: 0;

padding: 0;

height: 31px

}

   

Note, the first-child pseudo-class will not work in IE unless a DOCTYPE tag has been included in the master page file, which does not come by default with default.master. Check out DOCTYPE info here. When everything is in place, the arrow menu will drop the background, and the web part title bar will look like this:

   

   

Please remember that details such as padding and height will more than likely appear differently in IE than in Firefox, and you will have to make adjustments accordingly.

   

If you want to create a web part title bar with three images, some of the CSS will have to get flipped around, and a new style will be added. In the below example, the parent table cell container is set to have the repeating background that makes up the middle of the bar, the child H3 tag was switched to contain the far right image instead of the far left, and a new child using the span tag was added setting the image to the far left.

   

.ms-WPHeader td:first-child {

background: rgb(242,181,15) url('/images/wpgradmiddle.gif') repeat-x;

margin: 0;

padding: 0;

height: 31px

}

.ms-WPHeader TD h3 {

background: url('/images/wpgradright.gif') no-repeat top right;

margin: 0;

padding: 7px 7px 0px 0px;

height: 24px;

font-size: 1.2em;

color: black

}

.ms-WPHeader TD h3 a:link, .ms-WPHeader TD h3 a:visited {

color: black

}

.ms-WPHeader TD span:first-child {

background: url('/images/wpgradleft.gif') no-repeat top left;

padding-top: 7px;

padding-left: 25px

}

   

And the result looks like this:

   

   

Sorce: http://www.heathersolomon.com/blog/articles/brandsppart3a.aspx

Using RadComboBox as a navigation drop down

We are using Telerik Win forms in our latest project and found almost no documentation what so ever about the rad controls. Still this controls are sometimes a big improvement to the standard Win forms, one good example is the RadComboBox. We used this ComboBoxes to create our own navigation bar in a win form application. Here are the basic steps so you can create your own navigation bar or learn how to use the RadComboBox a little better.

Once you placed the RadComboBox, you will want to fill it. Telerik provides you a perfectly fitting class for this that is called RadComboBoxItem. This object inherits form System.Web.Ui.WebControls so I'm sure you will find whatever you are looking for your ComboBox. To do our navigation bar we will only need 2 properties from this class, RadComboBoxItem.Text and RadComboBoxItem.Tag.

So after this little introduction let's make our navigation bar. We have placed a RadComboBox and a ListView on a form. The ListView already shows folders and files from your local driver and now we want to add the folders visited by the user to our navigation bar. Whenever an event fires do to the user navigating through your ListView you can simply use this code to fill up your navigation bar:

 

RadComboBoxItem ComboItem = new RadComboBoxItem();

ComboItem.Text = directory.FullName;

ComboItem.Tag = directory;

 

Being directory a System.IO.Directory class which the user is currently visiting.

Using JS Date() for validation

Lately I was writing some validation functions in JavaScript for a moving date. The date had to exist and it had to be in the future. Since I found some trouble I was not expecting I will write my experience hopping it may help you if you're currently having the same problems.

First I want to tell you a little bit about the JavaScript Date object:

Date() handles overflow, which means that if you introduce a wrong date like 31.02.2003 (dd.mm.yyyy) it automatically is transformed into 3.03.2003. This is because Date() counts every millisecond since January 1, 1970 to get the current date. In other words JavaScript Date() calculates the date depending on the milliseconds passed since January 1, 1970 and it happens to be that 31.02.2003 has the same milliseconds value then 3.03.2003. This is actually very us full if you have to calculate a date 10 days from now, but absolutely worthless if you are validating a specific date introduced by a user.

Now first thing to do is to use regular expressions to be certain that the user introduces the date in the correct format (like dd.mm.yyyy)

function CheckDateFormatRegex(sDate)

{

var regular = /^([0]?[1-9]|[1|2][0-9]|[3][0|1])[.]([0]?[1-9]|[1][0-2])[.]([0-9]{4})$/;

return (regular.test(sDate));

}

Test() returns true if the string passed matches the regular expression.

Second we will check that the date exists (special about this are the leap years.)

function isLeap(year)

{

if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)

{

return true;

}

else

{

return false;

}

}

This function returns true if it's a leap year

Now, split the string given by the user, since you first check if the string matches the regular expression you can now easily separate the days from months and years, with a switch on witch month you can check if that month has 30 or 31 days and in case it is February, with our isLeap(year) function we can check if it has to have 29 or 28 days.

function validDateCheck(sDate)

{

var splitedDate = sDate.split(".");

var day = (parseInt(splitedDate[0],10));

var month = (parseInt(splitedDate[1],10));

var year = (parseInt(splitedDate[2]));

if (year >= 1800)

{

if (month >= 1 && month <= 12)

{

switch (month)

{

//Months with 31 days

case 1:

case 3:

case 5:

case 7:

case 8:

case 9:

case 10:

case 12:

if(day >= 1 && day <= 31)

{

return true;

}

else

{

return false;

}

break;

         //Months with 30 days

case 4:

case 6:

case 9:

case 11:

if(day >= 1 && day <= 30)

{

return true;

}

else

{

return false;

}

break;

         // February

case 2:

if (day >=1)

{

if (isLeep(year))

{

if(day <= 29)

{

return true;

}

}

else if (day <= 28)

{

return true;

}

}

return false;

break;

}

}

else

{

return false;

}

}

else

{

return false;

}

}

After this monster function you can now transform the string into a date and check if the date introduced is in the future. (Date() has always the current date as default value).

var fromSplitted = sDate.split(".");


//Date(int year,int month - 1, int day)
//Date() stores the months from 0 to 11 that is why you have to subtract 1.

var dt = new Date(parseInt(fromSplitted[2]), parseInt(fromSplitted[1],10) - 1, parseInt(fromSplitted[0],10));
var
now = new Date();

if (dt.getTime() >= now.getTime())

{

return true;

}

else

{

return false;

}

getTime() gets the time in milliseconds since January 1, 1970

1 - 10 Next

 ‭(Hidden)‬ Admin Links