Coderock

--------------------------------
link hover image

How to build a responsive scrolling webpage using jQuery and Twitter Bootstrap.

Frontpage calendar image October 25, 2014

            Today I found a great artlicle about “How to build a responsive scrolling webpage using jQuery and Twitter Bootstrap”. The HTML We’ll assign the class of .scroll-link to all our main nav links, and .scroll-top to our logo. Then we’ll create .page-section divs and some content for each page […]

link hover image

Error: There is a duplicate ‘system.web.extensions/scripting/ webServices/jsonSerialization’ section defined

Frontpage calendar image October 23, 2014

Error: There is a duplicate ‘system.web.extensions/scripting/webServices/jsonSerialization’ section defined Solution If your plan is to deploy to an IIS that has an Application Pool running in .net 4.0 you will need to cleanup the web.config that includes all the section Definitions that point to .net 3.5. The reason this fails is because these section definitions are […]

link hover image

ASP.net MVC Multiple Select item(ListBoxFor , DropDownListFor ) using control select2

Frontpage calendar image October 17, 2014

Use Select2 Library in Asp.net MVC. Apply select2 on ListBoxFor / DropDownListFor : JS $myContainer.find(“select”).select2({ placeholder: ‘Select Issue’, width: ‘220px’, allowClear: false … }); SelectedPersonIds – where will save selectedIds Persons – full list of persons Model: public SelectList Persons { get; set; } public List SelectedPersonIds { get; set; } View: @Html.ListBoxFor(x => x.SelectedPersonIds, […]

link hover image

AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. – Error being thrown while building asp.net site.

Frontpage calendar image October 12, 2014

Everytime I build my site in VS2010 I recieve a few ajax errors before the site loads here they are in order as they pop out on the build: Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, […]

link hover image

Use “Protocol Buffers” serialization from your .NET code

Frontpage calendar image October 10, 2014

Introduction protocol buffers is the name of the binary serialization format used by Google for much of their data communications. It is designed to be: small in size – efficient data storage (far smaller than xml) cheap to process – both at the client and server platform independent – portable between different programming architectures extensible […]

link hover image

SQL Error: The version of SQL Server in use does not support datatype ‘datetime2’

Frontpage calendar image September 19, 2014

The DBA doesn’t use datetime2 because it’s new in SQL Server 2008 and the site runs on 2005. It turns out that Entity Framework 4 somehow got the idea to use SQL Server 2008. The fix was to edit the .edmx file in an XML editor and set the ProviderManifestToken=”2005″ instead of 2008. Here’s how […]

link hover image

ASP.NET Session State shared between IE Tabs and IE8

Frontpage calendar image September 17, 2014

1. User open an IE instance and logs into a website where a session is created. 2. Then user opens another tab and tries to access the same website.  Without logging in, the user is already inside the session. 3. In this case, its clear that the session is shared between the tabs. To avoid […]

link hover image

Wait until all jQuery Ajax requests are done?

Frontpage calendar image September 5, 2014

If you need to wait for all Ajax requests to be done before to execute the next one you can use when function. $.when(ajax1(), ajax2(), ajax3(), ajax4()).done(function(a1, a2, a3, a4){ // the code here will be executed when all four ajax requests resolve. // a1, a2, a3 and a4 are lists of length 3 containing […]

link hover image

C#: How to Count Duplicates in List with LINQ

Frontpage calendar image August 12, 2014

I have a list of items aaaaa ID bbbbb ID ccccc ID aaaaa ID bbbbb ID bbbbb ID bbbbb ID I want to sort by the highest number of duplicates. aaaaa ID 2 bbbbb ID 4 ccccc ID 1 You can use “group by” + “orderby”: Solution: //Using extension methods var q = list.GroupBy(x => […]

link hover image

IIS URL 2.0 Redirect non www to www

Frontpage calendar image August 12, 2014

Add following config entries to root web.config inside the system.webserver element: < rule name="Force www" stopProcessing="true" > < match url="(.*)" / > < conditions > < add input="{HTTP_HOST}" pattern="^www.domain.com$" negate="true" /> < /conditions> < action type="Redirect" url="http://www.domain.com/{R:1}" /> < /rule>