FCK Editor Validation

Here is a good example for FCK editor validation.

Declare a Custom Validator;

<asp:CustomValidator runat="server" ID="cvBody" SetFocusOnError="true" Display="dynamic" Text="The Body is required" ClientValidationFunction="ValidateContentText"></asp:CustomValidator>

Add this Javascript function to your page

function ValidateContentText(source,args)
var fckBody= FCKeditorAPI.GetInstance('<%=FCKeditor1.ClientID %>');
args.IsValid = fckBody.GetXHTML(true) != "";

Ref: “fck validation

Dynamic Data-Driven User Interface

In the below link, you can see how we can implement a dynamic data-driven user interface.

That means, the administrator of a web application can determine, what all controls are to be displayed in the user-side. Very useful article to begin with.

Creating a Dynamic Data-Driven User Interface

Critical Vulnerability in ASP.Net

A major security vulnerability was discovered in ASP.net last week and Microsoft has released a workaround to fix this issue. Using this vulnerability a hacker can gain access to any files in a web server which includes web.config file which mostly contains sensitive data.

I would recommend all of those who are working on ASP.Net application to read this:



Importing XML to SQL table

This post demonstrate importing the data expressed in XML to Microsoft SQL Server using the SqlBulkCopy class.

Before importing, you should create a table to receive the data that the SqlBulkCopy class process. Here in this example we will use a table “DummyEmails” to receive the data. The XML file which we use to import is “Email.xml”.


DataSet xmlDS = new DataSet();
//Name of the XML file

//Create the connection object
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings[ "LMSConnectionString"].ToString());

//Creating the SqlBulkCopy object
SqlBulkCopy sqlBC = new SqlBulkCopy(connection);

//Specify the destination database table name
sqlBC.DestinationTableName = "DummyEmails";

//If the destination database table's column names doesn't match with the XML element names,
//then we have to relate the XML elements and the table column name.
//For that you can use the below code;
//sqlBC.ColumnMappings.Add("EmailId", "Email_id");
//sqlBC.ColumnMappings.Add("EmailAddress", "Email_Address");
//1st Parameter:Source Column, 2nd Parameter:Destination Column
//You may use the Column index too


catch { }

The SqlBulkCopy class can be used to write data only to SQL Server tables. However, the data source is not limited to XML file; any data source can be used, as long as the data can be loaded to a DataTable instance or read with a IDataReader instance.

Database table to XML file

Here I give an example of how we can create a XML file from a database table.

In this example, I had populated a dropdownlist with the tables in a database. Then I choose a table from the list, which needs to be generated as a XML file.

Listing all the tables in the Database

Listing all the tables in the Database

We will generate the XML file in the ‘SelectedIndexChanged’ event of the DropDownList.

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
DataSet ds = new DataSet();

//Create the connection object
SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings[ "LMSConnectionString"].ToString());

string strQuery = "Select * from " + DropDownList1.SelectedItem.Text;

SqlCommand sqlCmd = new SqlCommand(strQuery, sqlConn);
SqlDataAdapter sqlAdptr = new SqlDataAdapter(sqlCmd);

XmlDataDocument doc = new XmlDataDocument(ds);

//The name of the XML file to be generated
catch{ }

The above code will generate an XML file with the same name of the database table selected, in the root directory.

Microsoft’s WebsiteSpark Program

Microsoft announced a new program which is designed for independent web developers and web development companies that build web applications and web sites on behalf of others. This program offers software licence that we can use for three years at no cost.

Here is a list of software which can be downloaded once you enrolled in to this program:

  • 3 licenses of Visual Studio 2008 Professional Edition
  • 1 license of Expression Studio 3 (which includes Expression Blend, Sketchflow, and Web)
  • 2 licenses of Expression Web 3
  • 4 processor licenses of Windows Web Server 2008 R2
  • 4 processor licenses of SQL Server 2008 Web Edition
  • DotNetPanel control panel (enabling easy remote/hosted management of your servers)

The only two requirements to join the program are:

  • Your company builds web sites and web application on behalf of others.
  • Your company currently has less than 10 employees.

For more information check:

ScottGu’s Blog or Microsoft’s site.

Ajax Loading Images

Here is a site from where you can generate your-own ajax loading images.


Easy as 1-2-3

1. Select type of indicator, background color and foreground color.
2. Generate the image.
3. Download the generated image.