How to Create a Simple Report in Windows Forms Using Infragistics Reporting


Infragistics provides a complete cool set of products in its reporting library. In this post we will see how we can create a very simple report using Infragistics set of controls. This post assumes that you have already installed Infragistics Reporting on your system. If not, you can download it from here. Let’s get started –

  • Open Visual Studio & create a new Windows project. I will name the project as IGReport1 (here IG stands for Infragistics)infragisitcs-reporting-1
  • I have added a Report folder in my project to store all reports under same location. Then we add a new Infragistics Report to the project using “Add New Item”.infragisitcs-reporting-2
  • Once the report is added, you will see all relevant libraries are automatically referenced by Infragistics in the project and the report would look something like below screenshot –infragisitcs-reporting-3
  • Now, we will configure a data source for the report to display the data. To do so, we will either click on the center of the report that says “Add a Report Data Source or use Reporting Controls from the Toolbox to start designing a report” or we can do so via “View menu > Report Data Explorer”. They both open the same window. We will be using the “Report Data Explorer” approach.
  • Click on the 1st icon as marked in Red above to add a new data source.infragisitcs-reporting-4
  • Choose your type of Data Source and Click Next. We will use SQL Data Source for now.infragisitcs-reporting-5
  • Define the connection to SQL using the “New Connection” button and click “Next”. You can also name the Connection String to whatever you want to.infragisitcs-reporting-6infragisitcs-reporting-7
  • Once the connection is configured, the wizard displays you a list of all tables/views that you can use to build a query for retrieving data for the report. You can either select a table or use “SQL Builder” to create a new query. Also, you can name your data source to your choice. Once you have created the query, click Next.infragisitcs-reporting-8
  • In the next screen, you can test your query results using the “Test Query” button. If you’re happy with the result set, click “Finish” else go back and modify the datainfragisitcs-reporting-9
  • After the data source has been configured, you would see the entire columns under “Report Data Explorer” as belowinfragisitcs-reporting-10
  • Time to put the fields on the report. Just drag the data source , here ‘SqlDataSource1’ to the Report Body section and you’re done.infragisitcs-reporting-11
  • You can also click on “Preview” button present at the bottom of the report designer to view the final report how it looks like. The one we created looks like below –infragisitcs-reporting-12
  • Our Report part is done. Now, let us show this report on the Windows form. To show an Infragistics report in Windows Forms project, we will need another control provided by Infragistics named as “UltraReportViewer”. Let us add the control to our main form and configure it to display the report.infragisitcs-reporting-13
  • Now, run the project and it will look something similar to the below one.infragisitcs-reporting-14

Hope you like this article. Keep learning and sharing!

How To Refer Next & Previous Controls on HTML Page Using jQuery


In this post, we will see how can we refer to previous and next controls present on an HTML page using jQuery.

jQuery provides 2 very useful functions .prev() and .next() with the help of which we can refer to the immediate previous/next sibling of a given control. This is to be noted that these functions limit to the current reference of a DOM element.

From the jQuery documentation –

.prev() gets the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector

.next() gets the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.

Let’s see it in action –

<div id="div1">
   <input type="text" id="d1t1" />
   <input type="text" id="d1t2" />
   <input type="text" id="d1t3" />
<div id="div2">
   <input type="text" id="d2t1" />
   <input type="text" id="d2t2" />
   <input type="text" id="d2t3" />

In the above example, you can traverse between text boxes with ID ‘d1t1′, ‘d1t2′ and ‘d1t3′ or ‘d2t1′, ‘d2t2′ and ‘d2t3′ using the .prev() and .next() functions. You will not be able to traverse between ‘d1t1′ and ‘d2t1′ using these functions because they are contained in different parent div blocks. However, you can traverse between ‘div1′ and ‘div2′ using .prev() and .next() functions because they are immediate siblings.

Considering the same example above, lets see the below jQuery snippet now –

<script type="text/javascript" src="//"></script>
<script type="text/javascript">
        $(function () {            
            $("#d1t2").focusout(function () {

In the above snippet, I have handled focusout() event for the textbox ID “d1t2″. We use the .prev() and .next() functions to get the value of text boxes with ID ‘d1t1′ and ‘d1t3′ respectively.

Hope this gives you a brief insight on how .prev() and .next() functions work. In case you have any questions, let me know.

Keep learning & sharing!

How To Clear Items of ASP.Net DropDownList Control Using jQuery


In this post, we will see how can we clear all items of a ASP.Net DropDownList control using jQuery.

To start with, we will define a ASP.Net DropDownList control on our .aspx page and a button with the help of which we will be clearing the items of the DropDownList control. We assign it a specific class using the CssClass property that we can refer to in jQuery.

<asp:dropdownlist ID="lstPlayers" CssClass="lst-clear" runat="server">
            <asp:listitem Text="Sachin" Value="Sachin"></asp:listitem>
            <asp:listitem Text="Sehwag" Value="Sehwag"></asp:listitem>
            <asp:listitem Text="Dravid" Value="Dravid"></asp:listitem>
            <asp:listitem Text="Yuvraj" Value="Yuvraj"></asp:listitem>
            <asp:listitem Text="MS Dhoni" Value="MS Dhoni"></asp:listitem>
<input type="button" id="btnClear" value="Clear Items" />

After our controls are defined, we bind the click event of the button to clear the items using the .empty() function as below –

<script type="text/javascript" src="//"></script>
<script type="text/javascript">
        $(function () {            
            $("#btnClear").click(function () {

Hope you like this. Keep learning and sharing!

Solution: The server response was: 5.7.0 Must issue a STARTTLS command first. i16sm1806350pag.18 – gsmtp


When sending emails via code using Gmail as mail server, we sometime get this error. This blog post explains the error and the solution to the same.

The error occurs when the code tries to authenticate Gmail server using the given credentials over non-SSL layer and does not encrypt the connection.

To resolve this, you need to set EnableSsl property of your SmtpClient class’s object to true as mentioned below –

  SmtpClient client = new SmtpClient("");
  client.EnableSsl = true;

Hope you like this. Keep learning and sharing! Cheers!

How to Setup Online Reservation Form on your WordPress Website

Today, WordPress is one of the widely used CMS for creating blogs as well as websites across the world. Currently around 23% of websites in the world are powered by the WordPress Platform. This means that almost business of every niche is using WordPress for their website. Today, I will be reviewing a plugin that would help Restaurant owners take their business online with few simple clicks. If I say, a restaurant owner can start taking orders online on its WordPress website in 5 minutes, how cool would be that? The plugin name which I am talking about here is – “ReDi Restaurant Reservation”. Let’s begin with the plugin –

  • Download the plugin here.
  • Go to Plugins page of your WordPress website and upload it.
  • Activate the plugin.
  • As soon as the plugin is activated, the plugin automatically creates a new page named “Reservation” on the website. Also, you can configure the plugin settings from admin section.

Plugin Features

  • Automatically checks for available timings and slots of your restaurant
  • Confirm your visitor’s booking/reservation immediately within minutes via email
  • 24 hour availability for your visitors from your online reservation website
  • Impress your visitors by knowing them face to face as the plugin auto retrieves the user’s public Gravatar image
  • Comes with inbuilt responsive design that allows you to access upcoming reservations even when you’re on mobile and doesn’t have access to your tablet/PC
  • Reduces the manual work involved and thus increasing efficiency
  • Allows you to set the Restaurant Open timings
  • Allows you to configure the minimum and maximum number of persons allowed for booking a reservation
  • Sends emails automatically for each action performed by the user.  Some of them are –
    • Email to client when reservation is created.
    • Email to client when reservation is cancelled.
    • Email to restaurant when reservation is created or cancelled.
    • Full list of upcoming reservations/past reservations.
  • Allows you to take corporate/Large Group bookings from your website.
  • From the admin panel, lets you view/manage all the reservations made on your website.

Configuring the plugin

To configure the plugin go to Redi Reservations > Settings in Admin. Below are the different things that you can configure on the plugin –

  • Minimum Number of persons per Reservation
  • Maximum Number of persons per Reservation
  • Reservation Time
  • Time Slot Interval
  • Early Booking for large events/seminars/corporate events
  • Create Custom fields you need for booking a reservation
  • Restaurant Timings

Once you’ve configured the basic settings, this time to see the plugin in action.

Other Features

Apart from this, the plugin also offers some super cool features such as –

  • Availability of Seats in your restaurant on different days of the week
  • Perform different actions on different days of the week based on the restaurant timings and give your users a different flavor of booking
  • If you’re going out for a vacation and the restaurant is closed for few days or for some reasons, the restaurant services need to be put on hold, it’s easy to set it up via the plugin. You just need to use the “Blocked Time” features of the plugin and the plugin takes care of the rest
  • Configuring Email Templates. You are able to configure the default templates provided by the plugin to suit as per your website look and feel.

These features are part of the “Basic Package” functionality of the plugin that needs to be subscribed to at a very nominal rate of only 5 euros per month.


redi1redi2 redi3 redi4 redi5 redi6

I am sure you would like the plugin if you start using it.

Hope this article helps you. In case you need any customizations to the plugin or any new modifications, I am available and you can contact me via this.

Connect Access 2007/2010 Database Using C#


In this post, we will see how can we connect Access 2007/2010 database with C#. As we know Microsoft introduced new Access format from Access 2007 onwards (.accdb extension), we cannot use the default JET.OLEDB provider that we used to use before.

With the new database, Microsoft also launched a new provider namely ACE.OLEDB to connect with the database. Let’s see a quick sample below –

        private DataTable GetStudents()
            DataTable dt = new DataTable();
            using (OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Schools.accdb;Persist Security Info=False;"))
                OleDbCommand cmd = new OleDbCommand("SELECT * FROM Students", con);
                OleDbDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)

            return dt;

The above code connects to an Access 2010 database using the new connection provider with Students table in Schools database and retrieve all records. The most important point to note in the code is the Connection Provider  – “Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Schools.accdb;Persist Security Info=False;

Hope you like this post. Keep learning & sharing! Cheers!

How To INSERT Values Explicitly in Identity Column in SQL


In this post, we will see how can we insert explicit values in an Identity column in a table in SQL Server. Normally, the data in IDENTITY column should not be entered manually, but there are certain circumstances where you want to insert custom data in the IDENTITY column.

If you try entering data in IDENTITY column, you get the following error –

Msg 544, Level 16, State 1, Line 2
Cannot insert explicit value for identity column in table 'MyTbl' when IDENTITY_INSERT is set to OFF.

To resolve this error, you need to execute the following command on your SQL Server.


Executing the above command tells SQL to allow insertion in Identity columns of Table MyTbl. Be sure to change the table name in the query before executing on your SQL Server.

To Turn off insertion in IDENTITY columns, you can use the following command –


Hope you like this post! Keep learning & sharing! Cheers!