Total Pageviews


How to use RDLC with

How to use RDLC with
Sql server reporting service without instilling SSRS

I just passed thru a situation where my client does require 2 reports to be developed in SSRS ( SQL Server Reporting Service ). It was not good advise to spend extra money behind SSRS on shared hosting as his requirement was very small. I show some example of RDLC (Report Definition Language Client-side) to my client and he was very excited about that.

I thought it’s nice to share this with all my blog readers and my friends.

Step : 1 Create a Parameterized Store Procedure.
(I have used table called ProjectDetail for this tutorial )

    CREATE PROCEDURE [dbo].[ReportProjectDetail]
      @ProjectID  INT=NULL ,
      @FromDate   DATE=NULL,
      @ToDate     DATE=NULL
           SELECT      ProjectID,
          FROM   ProjectDetail                            
          WHERE (@ProjectID =NULL or ProjectID=@ProjectID)
          AND   (@FromDate IS NULL OR CreatedOn BETWEEN @FromDate AND                        @ToDate)

     END TRY                                              
      BEGIN CATCH                                    
          PRINT Error_Message()              
          DECLARE @msg VARCHAR(MAX)
          SELECT @msg = ERROR_MESSAGE()
          EXECUTE ERR_LogError
          RAISERROR('Error in %s: %s', 16, 1, 'ReportProjectDetail',@msg)
      END CATCH                                            

Step : 2 Create a DataSet using the DataSet Designer
  • Start by running Visual Studio and select New Website from the Start page.
  • Add ASP.Net folder App_Code
  • In Solution Explorer Right Click on App_Code > Add new Item > DataSet
  • Now select DataSet & Give name. e.g. ds_ProjectDetail.xsd and Save.
  • Now Right Click anywhere in DataSet sceen and select Add from the context menu.
  • Select Table Adapter In to Wizard. Now create data table.
  • Now choose Existing Store procedures.

Step : 3 Create a report  definition

  •  In Soultion Explorer right click on & select > Add New Item > Reporting > Report 
  • Now Given report name e.g. rptProjectDetail.rdlc Click Add to your project.
  • Now Drag a table from the report designer screen.
  • Now Dataset Properties has to be come in pop up now give your dataset name next choose your dataset next select available reports & last click OK.
  • The table has in three Bands, first header, second detail, & last footer bands. 
  • After created your dataset, it will appear on your left panel in Website Data Source window.
  • Expand it and drag the file to the report designer page . For example, drag and place it in the Table Fields.
  • After you have assigned the attribute, now  report creation is done.

    Step : 4 Add Report Viewer control into your ASPX page


    • In Solution Explore Right click > Add new item >Web > Web Form  now give name e.g. rdlcDemo.aspx and click on Add.
    • Now Open your Left Side Toolbox and drag the Report Viewer control to your ASPX page (In Design mode).
    • Once your have Drop n drag Control on aspx Webpage , select it and click on the arrow on the top right corner to choose your rdlcReport.rdlc report in dropdown list.
    • Don’t Forget to add namespace Microsoft.Reporting.WebForms to be in your code-behind file.

    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.Common;
    using System.Web.UI;
    using Microsoft.Practices.EnterpriseLibrary.Data;
    using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
    using Microsoft.Reporting.WebForms;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.UI.WebControls;
    using System.Data;
    using DataAccessLayer;

    protected void GenerateReportButton_Click(object sender, EventArgs e)
            ReportViewer1.Visible = true;
            string connectionString = ConfigurationManager.ConnectionStrings

            Database db = new SqlDatabase(connectionString);
            DbCommand command = db.GetStoredProcCommand("ReportProjectDetail");
            db.AddInParameter(command, "@ProjectID", DbType.String, ddlProject.SelectedValue);
            if (calFromDate.Text.ToString() != "")
                db.AddInParameter(command, "@FromDate", DbType.String, calFromDate.Text.ToString());
            if (calToDate.Text.ToString() != "")
                db.AddInParameter(command, "@ToDate", DbType.String, calToDate.Text.ToString());
            DataSet dataset = db.ExecuteDataSet(command);
            ReportDataSource datasource = new ReportDataSource("DataSet1", dataset.Tables[0]);




    Bind and Run The Report

    Now  Press F5 to Run the .aspx page.



Free Icons,Images and Animations with Visual Studio 2010

As Developer many times we are looking for good icons and images to use in our application. Microsoft Visual Studio gives lots of icons and images free with its bundle.

One can find ImageLibrary.Zip file in

 "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\VS2010ImageLibrary\1033"

unzip the file and use whatever you want to.



How to implement MVC (MVC3) model view architecture

In this tutorial one can learn the basics of building an ASP.NET MVC3 Web application using Microsoft Visual Studio, which is a free version of Microsoft Visual Studio.
Before you start, make sure you have the following things installed using the Web Platform Installer.

Visual Studio Web Developer Express with SQL Express
SQL Management Studio

A Visual Web Developer project with C# source code is available to accompany this topic. Download the C# version here. If you prefer Visual Basic,you can apply all these steps using Visual Basic as you Templates.

You'll Learn In this tutorial :-

How to implement a new ASP.NET MVC project solution.
How to implement ASP.NET MVC controllers and views.
How to implement a create new database using the Entity Framework code-first paradigm.
How to retrieve and display data.
How to edit data and enable data validation. 

Getting Started

Start by running Visual Studion 2010 Ultimate and select New Project from the Start page.

Create Your First Application in ASP.NET MVC3 Web Application

In the New ASP.NET MVC 3 Project dialog box, select Internet Application. Leave Razor as the default view engine or you select ASPX View.

Now Click OK. Visual Studio Used Default templete for the ASP.NET MVC project which you created. Now you are working on this application.

Create The Model For The MVCStudent Application

  • Go To  Solution Explorer > App_Data >  Add > Existing Item explorer to locate the Student.mdf file. Select it and click Add.
  • Now Go To Solution Explorer > Models > Add > New Item Now Select ADO.Net  Entity Data Model.
  • Change the name of the model to Model1.edmx and click Add. 

  • In the Choose Model Contents window, select Generate from database and then click the Next button. 
  • On the Choose Your Data Connection page, select Student.mdf in the data connection drop down and click Next.
  • Check the Tables checkbox in Choose Your Database Objects (shown in Figure 3) and click Finish.
Visual Studio will open the Entity Data Model designer with the new model,

From the Debug menu, select Start Debugging.

On Keyboard Shortcut Press F5 to Start Debugging.


In default template on right side gives you two pages and login page. Now close your browser and start some coding.


Adding a Controller

In First Step is to creat controller class. In Solution Explorer > Controllers > Add > Controller
Now name your new controller and click Add.

Notice in Solution Explorer that a new file has been created named StudentController.cs.
Now Creating Index View to Display the Student List
Right click anywhere in the Index method declaration (public ActionResult Index()).
In the context menu that opens click the Add View option.

The AddView dialog will open with the View name already set to Index.

Check the Create a strongly typed view checkbox.

Drop down the Model class option and select Blog.

From the Scaffold template options select List.

These selections will force Visual Studio to create a new web page with markup to display a list of Blogs. The markup for this web page will use the new MVC Razor syntax. Figure 12 shows the Add View dialog.

Click Add to complete the view creation.

Running the Application

            When you first created the MVC application with the template defaults, Visual Studio created a global.asax file that has in it an instruction, called a routing, that tells the application to start with the Index view of the Home controller. You’ll need to change that to start with the Index View of the Blog controller instead.

Open the global.asax file from Solution Explorer.

             Modify the MapRoute call to change the value of controller from “Home” to “Student”.

Now Run The Application 

Now run your application  and see you can create, edit, detail, 


ASP.NET MVC 3 Video Training By Plusalsight

        ASP.NET MVC gives you a prevailing, patterns-based way to construct dynamic websites that enables a clean partition of concerns and that gives you full control over markup for agreeable, responsive development. ASP.NET MVC includes many features that enable quick, TDD-friendly improvement for creating sophisticated applications that use the latest web standards.

          Microsoft has tied up with Pluralsight and is making 2 of the Web Application expansion technology courses FREE. Yes the courses on ASP.NET MVC and ASP.NET Web Forms is completely FREE OF CHARGE  is available at the following URL:


          Building Application with ASP.NET MVC 3 is a course designed to get you up and running with the MVC framework. The modules in the course will cover everything from setting up a development environment to deploying to a live web site. In between we’ll drill into the details of controller, views, models, AJAX features, and persisting data to SQL Server

Here is the ASP.NET MVC course list:-


How to use AJAX AutoComplete TextBox with SQL Store Procedure and Web Service


This article explains how to use AJAX AutoComplete TextBox with SQL Store Procedure and Web Service


AutoCompleteExtender is an ASP.NET AJAX tool that can be attached to TextBox control of When the member typing some keywords in the TextBox a dropdown panel will come in to action and related result will be displayed. So member can choose exact words from the panel by use of the arrow keys (Up / Down ) or mouse click. Here I will explain How to use AJAX AutoCompleteExtender with SQL Stored Procedures and Web Service

1) Open Microsoft Visual Studio.

2) Click on New Website.

3) Select ASP.NET Ajax Enabled Website and change the location to point your http://localhost/AutoComplete folder. Obviously, Default.aspx is added to your solution explorer.


         <form id="form1" runat="server">
         <asp:ScriptManager ID="ScriptManager1" runat="server">
         <asp:ServiceReference Path="AutoComplete.asmx" />
         <asp:TextBox ID="txtCountry" runat="server"></asp:TextBox>
         CompletionSetCount="12" />

Now drag and drop a Textbox from your Toolbox Pane. Then drag and drop a ScriptManager and AutoCompleteExtender to your Default.aspx page. Then add a webservice to your project as AutoComplete.asmx. First thing you have to do is to add the ScriptService reference to the webserive as follows.

Now, write a webmethod ‘GetCountryInfo’ to fetch the data from the store procedure as follows


       [WebService(Namespace = "")]
       [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

       public class AutoComplete : System.Web.Services.WebService

        public AutoComplete()

        public string[] GetCompletionList(string prefixText, int count)

          Database _db = DatabaseFactory.CreateDatabase("Connection string here");
          DataSet ds;
          SqlCommand objCommand = new SqlCommand("GetCountryInfo");
          objCommand.CommandType = CommandType.StoredProcedure;
          objCommand.Parameters.AddWithValue("@Country", prefixText);

          ds = _db.ExecuteDataSet(objCommand);
          // return ds.Tables[0];

          string[] items = new string[ds.Tables[0].Rows.Count];
          int i = 0;
          foreach (DataRow dr in ds.Tables[0].Rows)
            items.SetValue(dr["CountryName"].ToString(), i);
          return items;



See Example Here :

free gif maker

Download Demo

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews