19/09/2012 by Nitesh

Solution – Cannot serialize the DataTable. DataTable name is not set

.Net Library provides a very easy way to generate the XML schema of any dataset/data table using the WriteXmlSchema(). For this, we need to execute the following code: dt.WriteXmlSchema(“sample.xsd”) Using the above code, the schema of the datatable dt will be retrieved and saved in sample.xsd file. However, sometimes using the above code throws an…

Continue Reading »

12/09/2012 by Nitesh

How to Select a random row with Microsoft SQL Server

A quick post for all – We often find situations where we need to retrieve random records from a MS SQL table. The below query does the same for you. To generate a random record from a table in Microsoft SQL Server, we need to execute the following query: SELECT TOP 1 * FROM tbl_name…

Continue Reading »

31/08/2012 by Nitesh

Combine several images to form a single image using C#

Friends, Today, I was working on a problem where I required to add up two image to form a single image. The following code does the same for you. 1. Place a button from the toolbar on your C# form. 2. Select the button and press F4. 3. Change the name to cmdCombine and text…

Continue Reading »

24/08/2012 by Nitesh

Simple Date validation using Regex in Javascript

Many of us find difficulties while validating the date field in JavaScript. This is a simple example where I will explain you the basics of validating a date field using JavaScript. So, follow the steps below and get date validated on your form in few minutes: In your JavaScript section of the HTML page, define…

Continue Reading »

22/08/2012 by Nitesh

How to add a piece of Javascript just before the end of Form Tag in ASP.Net

In ASP.Net, we often require to add some piece of Javascript from Code-behind that should get added towards the end of <form> tag and not in the header of the form. For this, we need to use RegisterStartupScript function. The syntax to use the function is as below: Page.RegisterStartupScript(this.GetType(),”key_for_script”, “alert(‘Hey! This gets alerted after the…

Continue Reading »

1 32 33 34 35 36 38