In text:

1. Download “mysql-connector-net-6.2.2-src.zip”  from http://dev.mysql.com/downloads/connector/net/ and extract the zip file.  Note that we need ‘src’ version of library if we want to debug in visual studio.

2. Open your Visual Studio Solution and add  “Mysql.data.csproj”  located at  “MySql.Data\Provider\” inside the extracted archive.

3. Add this project’s reference to your project (mysql.data).

4. Now you can debug into mysql.data methods.

Advertisements

If you download any Pre-Janauray Design template from http://www.asp.net/mvc/gallery/default.aspx?supportsjs=true and trying to test with latest MVC  Release (after following ReadMe.txt),  chances of you getting an ugly error like below are real high.

Error

So how to make these template with new version? You can with very few changes to site.master page (This following example is for Bluebubbles template but this may work for most of the templates)

Views/Shared/Site.Master

Page Directives BeforeDirectives before changes

Page Directives After Changes

capture34

Head Section Before

capture4

Head Section After Changes

capture5

One of my co-workers asked me if I know on top of my head to remove additional white spaces in a sentence using C#.   We all know that Trim() removes white spaces at front and end…. and “Replace” can be used to remove all white spaces in string   BUT  he dont want to remove all spaces …he just wants to remove extra spaces if any….

Input :  This is              a test sentence   with    some                 spaces
Desired Output :   This is a test sentence with some spaces

Using RegEx here is the way, if you need it…. 

System.Text.RegularExpressions.Regex.Replace(input, @”\s+”, ” “);

Remember that this removes all whitespace characters including tabs, newlines  etc…  which is he wants anyway!

Do you want to see if User using latest browser  (IE7/FireFox 2  or later)?

System.Web.HttpBrowserCapabilities browser = Request.Browser;
string name = browser.Browser;
float version = (float)(browser.MajorVersion + browser.MinorVersion);
if ((name == “IE” && version >= 7) || (name == “Firefox” && version >= 2))
{
     // You are using IE 7( or later)  or Firexfox 2( or later)
}

obviously you could add other browsers and versions in the condition as you needed!

Assuming you are using Visual Studio 2008 and ASP.NET 3.5

1. Download AjaxControlToolkit-Framework3.5-NoSource.zip  from  Codeplex.

2.  Extract the zip file to a convenient location  say  C:\AjaxControlToolkit

3.  Open up Visual Studio 2008 and Create a new ASP.NET Website.  Name the site as myAjaxSite

4.  Once website created, Right-click anywhere on Toolbox and choose “Add Tab”.  Name the tab as AjaxControlToolkit.

5. Now right-click anywhere on AjaxControlToolkit region and select “Choose Items”. That will bringup ‘Choose Toolbox Items’ window.

Select  ‘Browse’ and select “C:\AjaxControlToolkit\SampleWebSite\Bin\AjaxControlToolkit.dll”.  Then Click “OK”. It will add all AjaxControlToolkit controls/Extenders to Toolbox.

6. Now you are ready to start using AjaxControlToolkit.

In Part -2, we will start building Ajax site….

Problem 1 : This page is missing a HtmlHead control which is required for the CSS stylesheet link that is being added. Please add <head runat=”server” />

Solution :  make your HEAD tag  to <HEAD runat=”server”>

problem 2 : The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).

Solution:  Looks like you are using <% tags in your HEAD section code like Javascript code etc…. To fix it wrap your head section with <div runat=”server”>  and </div>

***** Note that this Post has been completely rewritten to simplify the process and old post has been deleted*****

This is the step-by-step process to tweak FCKEditor to use Netspell as spellchecker

1. Download Netspell.2.1.7.zip

2. Extract the zip file to your wwwroot/ and rename it to Netspell (for convenience)

3. Run  setup.bat in Netspell folder

4. Pull up http://localhost/Netspell/demo/Demo.Web.CSharp/default.htm  page and make sure spell checker works.

5. Now download FCKEditor_2.6.2.zip

6. Extract it to wwwroot/  and rename it to FCKEditor.

7. Assuming you are using ASP.NET with c#,  we are going to use Netspell/demo/Demo.Web.CSharp/SpellCheck.aspx as the base page for spell checking.

8.Modify the FCKeditor\fckeditor\fckconfig.js to set spellchecker as Netspell

FCKConfig.SpellChecker   = ‘NetSpell’ ; 

9. Modify FCkEditor/fckeditor/editor/_source/Commandclasses/fckspellcheckcommand_ie.js. I added all the required javascript to this file so that you dont need to change any of the netspell files.  ONLY thing you need to be checked is location of SpellCheck.aspx.  I am using  /Netspell/demo/Demo.Web.CSharp/SpellCheck.aspx.   But if you are keeping this file somewhere else change this js file accordingly

Download FIle here

10. As we changed FCKEditor _source files, we need to compress them again to produce updated js files. For doing this download FCKPackager.exe from http://www.fckeditor.net/fckpackager

11. copy packager to /FCKEditor/fckeditor  folder and run it through command prompt
  C:\Inetpub\wwwroot\FCKeditor\fckeditor>fckpackager.exe

12. Create a basic HTML page to test.

 <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head>
<title>NetSpell Web Demo</title>
<script type=”text/javascript” src=”/FCKEditor/fckeditor/fckeditor.js”></script>
</head>
<body>
<form>
<script type=”text/javascript”>
var oFCKeditor = new FCKeditor(‘FCKeditor1’);
oFCKeditor.BasePath = “/FCKEditor/fckeditor/”;
oFCKeditor.Create();
</script>
</form>
</body>
</html>