Showing posts with label Show all posts
Showing posts with label Show all posts

Wednesday, 20 July 2016

Installing Core

Steps To Install Core


Step 1. Before Installing Core Let Fulfill Its Prerequisites As Below -

First you need to Install Visual Studio 2015 . You Can Download Free Visual Studio Community Edition From Link below -
Download Visual Studio 2015

For Mac & Linux Users You Can Use Visual Studio Code -
Download Visual Studio Code & Read Its All Details 

Step 2. After Download & Installing Visual Studio 2015 you need to make sure you have Visual Studio 2015 Update 3 Installed . You Can Download Visual Studio 2015 Update 3 From Link Below -
Download Visual Studio 2015 Update 3

Real ALL Details About Visual Studio 2015 Update 3 Here -
What's New Added in Visual Studio Update 3

Step 3 -  Please Check Out All Dependencies of Core Before Installing it . See All Dependencies of Core For All OS -
Dependencies of Core

Step 4 - Now Download & Install Core From link below -
Download Core

Step 5 - Now Core is Setup Head Towards Next Post To Make First Sample App in Core To Make Ensure its setup Correctly . Link TO Next Post is Below - 

Friday, 3 June 2016

Difference Between MVC and webforms

The main advantages of The Official Microsoft ASP.NET Site MVC are:
  • Enables the full control over the rendered HTML.
  • Provides clean separation of concerns(SoC).
  • Enables Test Driven Development (TDD).
  • Easy integration with JavaScript frameworks.
  • Following the design of stateless nature of the web.
  • RESTful urls that enables SEO.
  • No ViewState and PostBack events
  • SEO friendly URL by design
  • No ViewState (this may seem a bit of moving backward to some), but overall a good design
  • Clean View Markup (no additional HTML emitted)
  • 100% extensible. You can add your own controller with IOC, switch view engines at will, control model binding at wish etc
  • Rich UI support (possible through client side JS libraries like jQuery UI and others)
  • Pluggable architecture
  • Out of the box minimal IOC support
  • Out of the box support for mitigating antiforgery attacks and XSS vulnerability
  • MVC is Faster by default because of lack of viewstate and clean markup. But performance is subject and MVC by design is more performant that traditional The Official Microsoft AspDotNet webforms
Limitation of MVC 
  • There is little Bit Long Learning Curve as compared to Asp.Net webforms 
The main advantage of Aspdotnet Web Form are:
  • It provides RAD development
  • Easy development model for developers those coming from winform development.

Difference Between MVC and webforms

Friday, 1 May 2015

Using Report Viewer with Dataset Csharp and vb

For Using Report Viewer in or Desktop Application using Csharp or Visual basic I am today providing a simple step by step solution -

Demo File is also available to Download so that you can have a demo for how to use or Use Reports With Dataset in . I have provided Both Csharp and Vb code

Step 1 - First of Start a C# Project or Vb Project and then Add an Empty Webform to it .

Step 2 :- Now Right Click on Solution in Solution Explorer and Click on Add then click on New Item . Then Click On DataSet and Give a Name and Click Ok . This will add a Dataset in your Project . I will recommend it give dataset a name similar to database table whose data you want to show in Report Viewer

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 3 :- Now After Dataset is added Right Click on Dataset Page and Click on Add then click on DataTable It will add a DataTable

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 4:- Now Add Columns to DataTable and Must Ensure that the name of these DataTable column must be same to Names of Columns in Database that Corresponds to this DataTable

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 5 :- Now Again Right click on solution in Solution Explorer and Click on Add then click on New and then click on Report give it a name and click on ok . This will add a Report to your Project

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 6 :- Now From You Controls Toolbox in Visual Studio . Place a Report Viewer Control on your WebPage as shown in image below

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

 Step 7 :- Now Open your Recently Added Report file you will see it same as shown below

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 8 :- Now we need to Add the Previously added dataset or need to link the dataset we added in previous steps to the report file

Step 9 :- So for that linking Right Click on Dataaset folder in sidebar of Report Then Click on Add Dataset then you will see the following screen

Step 10 :- Now select the Added Dataset from Combox for DataSource and then after that Choose the DataTable from Next Last Combobox

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 11  :- Now Dataset Fields will be added Under Dataset folder in Left Sidebar of Report . Now you can Drag drop fields from Left Sidebar and also Place the Textbox for Labelling like I have added for ID,Name and heading etc

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 13:-  Now we need to Add the Code so Open Cshar Code side of Webpage where you have added the Report viewer control And Add the following code according to your choose language c# or vb

Now At Page_Load Event of your WebPage Add the Following Code According to C# or VB

Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.Reporting.WebForms

        'VB CODE
        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc")

        Dim dsUsersInfo As New DataSet1
        Dim con As New SqlConnection("Your Connection String")
        Dim cmd As New SqlCommand("select * from YourTableName", con)
        Dim da As New SqlDataAdapter()
        da.SelectCommand = cmd

        'DataTable1 is the DataTable we have created in Dataset1 that contains our columns
        da.Fill(dsUsersInfo, "DataTable1")

        Dim datasource As New ReportDataSource("DataSet1", dsUsersInfo)

        'CSharp Code
        'ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local
        'ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc")

        ' DataSet1 dsUsersInfo = new DataSet1();

        '        SqlConnection con = new SqlConnection("Your Connection String"));

        '            con.Open();
        '            SqlCommand cmd1 = new SqlCommand("select * from TableName", con);

        '            SqlDataAdapter da = new SqlDataAdapter(cmd1);
        '            da.Fill(dsUsersInfo, "DataTable1");
        '            con.Close();

        '        ReportDataSource datasource = new ReportDataSource("DataSet1", dsUsersInfo.Tables[0]);


Step 12 :- Now when you run the Page where you have added the Report viewer control It will show the Report with data from database

Wednesday, 11 February 2015

HTTP Error 500-22 - Internal Server Error The page cannot be displayed because an internal server error has occurred

Now At 11:47 PM I am going to write about how to solve HTTP 500.22 - Internal Server Error . This error is really very Bad Boy . It only display Error Message and does not give any detailed information about error as we don't normally allow for that . So Now I am going to give information how today Solved this error and what will be sure short and easy steps to solve this error so that you save your time .

I First tried to set CustomErrors="Off" in web.congig file just after <system.web> tag start But it does not helped so first i need to find way to see the error . So only way to see the error is through log file . I was using azure so I decided to turn on azure logging to check what is error

Enable Logging In Microsoft Azure Portal -

- Enable Application Diagnostics Logging 

1. Login to Azure Portal . In sidebar click on websites . Click on desired website
2. Now click on configure In Top Menu and scroll down and find 'Application Diagnostics'
3. Once found Do configuration as shown below -

Application Diagnostics For Application Logging - Windows Azure
Application Diagnostics For Application Logging - Windows Azure

- Enable Web Server Logging 

1. Login to Azure Portal . In sidebar click on websites . Click on desired website
2. Now click on configure In Top Menu and scroll down and find 'Web Server Logging'
3. Once found Do configurations as shown below -

Web Server Logging - Windows Azure
Web Server Logging - Windows Azure

4. After Doing Both Diagnostics Configuration . you must Save and Restart Azure Website .

How To Find Error In Azure Website Log

1. Now after Enabling Log you can see your log by logging in your FTP Client like CuteFTP or      FileZilla( In my case) . First login to your FTP Client of that website

2. Now at root you can see a folder named LogFiles as shown below -

LogFile In windows Azure
LogFile In windows Azure

3. Open the folder and then find a folder named 'DetailedErrors' Now open the folder here you can 4. see all your errors details for that particular website . as shown below -

Azure Website Log File Detailed Errors
Azure Website Log File Detailed Errors

5. So choose the latest file and download it to your computer and open it in browser and It will show you error in your azure website in Detail so that we can know error information to solve the error . In my case error was HTTP Error 500.22 error as shown by log file below snapshot -

Find Error Using Logs in windows Azure
Find Error Using Logs in windows Azure

 Cause of  HTTP Error 500-22 - Internal Server Error

The Main cause of  "HTTP Error 500-22 - Internal Server Error  The page cannot be displayed because an internal server error has occurred" is Managed Pipeline Mode in Application Pool . Integrated Pipeline Mode of Application Pool does not support some services and functionalities 

Solution For HTTP Error 500-22 - Internal Server Error  

Step 1- Change Application Pool From Integrated Pipeline Mode To Classic Pipeline Mode

FOR IIS USERS ON Windows Server

1. Open Control Panel Then GoTo Administrative Tools
2. Then choose IIS Manager
3. Now Change  App site's Managed Pipeline from Integrated to Classic.


1. Login to your Azure Portal . In sidebar click on websites . Click on desired website
2. Now click on configure In Top Menu and Under General Section find 'Managed Pipeline Mode'
3. Once Found Change mode from Integrated To Classic Pipeline Mode  as shown in snapshot below

Enable Classic Pipeline Mode Application Pool IIS and Windows Azure
Enable Classic Pipeline Mode Application Pool IIS and Windows Azure

Now after this change No other change will be required Everything is solved now . browse your website everything will be fine .

In case you face some Problem or Same Error Persist You may try the following solutions that can help in resolving issue 

 Changes in Web.Config File (Optional )

1. First open your Web.Config file and Search for <Configuration> Tag opening part and then insert following code in it and it should look like below --

        <validation validateIntegratedModeConfiguration="false"/>

Sunday, 25 January 2015

Using Entity Framework Code First Migration Asp MVC

 Code First Database Initializers

 Before understanding code first migrations, let's have a look at Code First Database Initializers   provided by Entity Framework. When you follow EF code first approach, then you have three op tions for initializing database as given below–
  1. CreateDatabaseIfNotExists

    This is the default database initializer class used by Code First. This class creates a database only if it doesn't exist. This initializer helps you to avoid any accidental deletion of the database.
  2. DropCreateDatabaseWhenModelChanges

    This database initializer class drop the existing database and re-creates it if there is a mismatch between the model classes and table schema. This initializer is useful during starting phase of development and testing when models are changing often and there is no concern about the existing database records.
  3. DropCreateDatabaseAlways

    This database initializer class always drop and creates a new database, whether it is already present or not with every run of the application. This initializer is useful during testing when you want to run the application with a fresh set of data.

    Why Code First Migrations?

    The above three database initializing approach become fail when you add new model classes and you want to update existing database without any deletion or change. To achieve this, you need to use EF code first migrations which allow you to update existing database with new model classes changes and your existing database remains same with your database records.

    Visual Studio Package Manager Console

    To create the database for these two entities within your application, go to the Package Manager Console option as shown below:

    Creating New Database

    Running Commands

    Run the following command to configure migrations within your project and for creating new database.
  4. Enable migrations

  5. Create migration

    Add-Migration MigrationsName
  6. Create upgrade/downgrade script


  7. Updating Existing Database

    Suppose you have added one more class named as Customer into your data model classes as given below:

    Running Commands

    Now for updating the database with new changes run the following commands as given below:
  8. Create migration

    Add-Migration MigrationsName
  9. Create upgrade/downgrade script


Friday, 2 January 2015

Nopcommerce Developer Guide

Internship - Day 1

Today was first day of my internship Period of 6 months . I am very happy to start my internship with Abax Technologies . Abax technologies is a recognized IT company Situated in Noida . It deals with Desktop , web and Mobile application development and providing solutions to market .

Mr. Rohit Jain is CEO of Company and I am doing Internship under their guidance .

Now came to work -- On 2nd January - 8:23 am Rohit Sir posted my first task on skype . My first task was first to learn more about Nopcommerce , Its Architecture , Plugin development , Module Development , Theme development and widget development .

First i need to download the source code for Nopcommerce form Nopcommerce office webiste then using that source code to compile it , set up its database then run a demo site in nopcommerce .

After setup the demo site for nopcommerce it started exploring its source code architecture and learn more about it from its developer's documentation

I have previously done a ecommerce website in Nopcommerce but at that time i used Nopcommerce 1.9 version that was version of nopcommerce Now i am going to use Nopcommerce 3.2 and this version is really cool . It is MVC version of nopcommerce using Linq queries instead of using sql and using Razor view engines and more flexibility . Actually I liked this version .

Important Links that i have studied and explored today -

Link for Nopcommerce Developer's Documentation
Nopcommerce Developer Documentation

Nopcommerce uses code first approach for each and every development component in nopcommerce so i decided to first give a look at code first approach to revise my concepts about codefirst approach

Code First Approach Documentation MVC

After Reading about code first approach of Nopcommerce I reached a Nerd Dinner app that is MVC app that uses code first approch for MVC application development
Nerd Dinner MVC App with Code First Approach

So that was it for the day i learned number of things today

Today I have explored following Modules -

1. Nopcommerce Installation v3.20 (mvc)
2. Explored Nopcommerce Developers Documentation
3. Exploring Nopcommerce Architecture
4. Explored Nopcommerce Theme CUstomization and Creating Own Theme
5. Exploring Plugin Development Documentation
     -- Created simple hello world Plugin

Next I will explore create plugins with database access and various nopcommerce inbuilt modules

Tuesday, 11 November 2014

Benefits of Html Helpers in Asp.Net MVC

So today i am going to give an overview on Html helpers in Asp.Net MVC . So first questions that stuck our mind are -

 What are Html helpers ?
 Why to use them instead of using simple Html coded controls
 What are their benefits in Asp.Net MVC

Html helpers are very much similar to Asp.Net web controls . But Html helpers are much more lightweight as compared to Web forms Server controls . The similarity between server controls in webforms and Html helpers in Asp.Net MVC are Viewstate . Means they both contain the ability to hold or update the data on postbacks using ViewStates for each controls .

Main  Benefits Of using Html Helpers in MVC

  • MVC Html Helpers contains Overloaded Methods like IPostBackDataHandler that Pre-populate the values of html helpers means it works similar to as viewstates
  • Html Helpers is also having one more advantage It provide inbuilt Validation for html helpers textboxes 
Available HTML Helpers 

There following HTML helpers can be used to render (modify and output) HTML form elements:

  1. BeginForm()
  2. EndForm()
  3. TextArea()
  4. TextBox()
  5. CheckBox()
  6. RadioButton()
  7. ListBox()
  8. DropDownList()
  9. Hidden()
  10. Password()

Sample Code To Demonstrate Use of Html Helpers


<%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
<% using (Html.BeginForm()){%>
<label for="FullName">FullName</label>
<%= Html.TextBox("FullName") %>
<%= Html.ValidationMessage("FullName", "*") %>
<label for="Username">Username</label>
<%= Html.TextBox("Username") %>
<%= Html.ValidationMessage("Username", "*") %>
<label for="Password">Password:</label>
<%= Html.Password("Password") %>
<%= Html.ValidationMessage("Password", "*") %>
<label for="Password">Confirm Password:</label>
<%= Html.Password("ConfirmPassword") %>
<%= Html.ValidationMessage("ConfirmPassword", "*") %>
<%= Html.CheckBox("ReceiveNewsletter") %>
<label for="ReceiveNewsletter" style="display:inline">Receive Newsletter?</label>
<input type="submit" value="Register" />


@Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.")
@using (Html.BeginForm()){ 
<label for="FullName">FullName</label>
@Html.ValidationMessage("FullName", "*")  
<label for="Username">Username</label>
@Html.ValidationMessage("Username", "*")  
<label for="Password">Password:</label>
@Html.ValidationMessage("Password", "*")  
<label for="Password">Confirm Password:</label>
@Html.ValidationMessage("ConfirmPassword", "*")  
<label for="ReceiveNewsletter" style="display:inline">Receive Newsletter?</label>
<input type="submit" value="Register" />

Advantage of Asp.Net MVC  is a part of .net platform for creating,building, deploying and running web applications using C#,VB etc .we can develop a web application by using Asp.Net Web Form and Asp.Net MVC. Asp.Net MVC is advanced technology that is most widely used nowadays . MVC is a great thing available for developers that makes work of developers easy and more flexible .

MVC stands for Model-View-Controller . MVC separates the code in 3 different things that make the code cleaner , flexible and easy to understand and modify . So Today I am going to tell some of big advantages or some good things that Asp.Net MVC provides as compared to Web-forms . This is not a comparison of Web-forms and MVC this is just overview or advantages or features that Asp.Net mvc provides us

1. Rapid Application Development ( RAD ) :- So first I will start with biggest advantage of Mvc and this is the thing that is most in demand in Enterprises and everywhere in development area . This is Rapid application development . Asp.Net MVC provides Database First Approach for developing WebApplications . This approach is used with Scanfolding Technique this technique is like a magic provided in Asp.Net MVC . Scanfolding technique tells if you have designed your database in good manner that means if you have Created Normalized Database with all like Primary keys, foreign keys ,One-many , many-many relationships then you need not to do more effort for developing rest on your application in Asp.Net MVC Rest of things will be created with less efforts using scanfolding . With Asp.Net MVC you can have your simple basic website ready within 1 minute after you created your Database . So that was explanation to RAD in Asp.Net MVC

In Pic below we are choosing MVC5 scanfolding template

Then it automatically generate code for us

2. Partial Layouts :- In Asp.Net we ofter use User controls that were used for code reusability we create a user control then where we require that type of code that we coded in user control we call that user control there . In similar way Partial Layouts is provided in Asp.Net MVC .Partial Layouts are very useful things provided in Asp.Net MVC . Partial Layouts are like Master Pages that we use in Asp.Net web-forms . These are used as master pages or master layouts that can be called in any view in Asp.Net MVC . Like in php we use include ( "partialheader.php" ); to include some header in all pages or some specific pages so instead of writting that code in all pages we call then there . Similar in Asp.Net Web-Forms We use content placeholders and contentplaceholders are placed in Master Pages and when we call these master pages and use then in child forms then code of child forms is placed in content placeholder area In the similar way Partial layout works . The partial layout contains @Renderbody in Razor view then replace the child page or code of  page that is calling it

3. MVC Is  Stateless : Asp.Net was Statefull by using viewstates or sessions but MVC is stateless . It will be wrong to say mvc is stateless it would say http is stateless . By stateless i mean there is nothing in http that holds the user session or that record the activity of user when user logged in etc so this was maintained or state was maintained using viewstate and sessions . This was used in Webforms because they contain server controls that contains viewstate and that postback the values and update viewstates But there is not server controls in Asp.Net MVC So it does not maintain states . It has divided the code in three patterns model-view-controller that handles everything That's why it says MVC is stateless But in actual http is stateless that why MVC is stateless

4. No Events : As we came to know there are no server controls in Asp.Net MVC so there are no events for any control as there are not server controls All this is handled by connection of controllers with views where views hold your html code or designing code and controller hold your logics code .

Difference Between ViewState and Session in Asp.Net

"View State and Session "
  The Two main State Management things used in Web applications . We cannot even think of an application without ViewState and Session . So today i decided to gave an overview of what is the difference between viewstate and session why these two terms exist and what are their usage To clearify this difference i am giving some points below

1. So First of all what is a Session ? -- A Session is a Time or a span of time upto which user used that webapplication or for how much session of how much period of time user has used your webapplication will be called session . Session contains some values that will be used throughout the user interaction with the webapplication and used in more than one webpage that user navigate So we can say that it is a variable in simple sense that takes our value from one page to another and Session got distroyed or killed automatically after a particular span or time or it is automatically destroyed or cleared when like user signout of application or when user close the browser

A live example would be a web application where a user login . Each user that logs into your system will have a unique session. We can hold additional data into the session which can be used as the user browses your site. We can hold the username, userrole, userpermissions simply by adding it to the session:

Session[“userrole”] = “programmer”; 
Session[“username”] = “Ageek”; 
Session[“userpermissions"] = “cangotohell”; 

A Session  stores the information on the server side  . It stores the values or it uses server memory for storage of data that it holds in . Session variables will use different new and unique session variables for each different user that logs in to web application . large amount of data can be stored on the session, web sites that have a large amount of traffic not use this method, because it will put a severe load on the server memory.

2. Now What is ViewState ? -- so we are clear with session now comes the turn of viewstate . So ViewState is also used for holding our important data But in case of viewstate data is kept in the single viewstate page . It means viewstate data is not taken from one page to another page in this point it is different from session . 

ViewState is only used to Track to analyse the changes that occur to current page during postbacks of data to pages .The viewstate of page can be viewed if you right click on webpage and then clickon view page source then you will see some code of lines similar to below code --

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value=””></input>

If you are having large number of viewstate fields then it will make the postbacks very slow as all viewstate values will be needed to updated during postbacks so it will make the webpage open slower

Data can be written into viewstate like we do in sessions . But it can retain that data only with life cycle of page after that it will be changed or updated .If you closes that page or redirects to another page then viewstate data will be reset .

How to fill data in viewstate and how to access that data 
ViewState[“PreviousPage”] = “”; 

Retrieving data form ViewState:
string PreviousPage = ViewState[“PreviousPage”].ToString();  

Tuesday, 14 October 2014

How To Create Printable Bootstrap Page

Every Day Is a New Learning Day . Today, I learnt a new thing with bootstrap When We use the page becomes responsive it will adapt its width and height and change it accordingly to the screen on which we are viewing that webpage that's the magic of Bootstrap .

 BUT there is one thing need to be noticed that is When we print that page . Like i needed to give one functionality in my web application to the client . Client wants a button when client click on that button a print preview of current page is given to client and page will be downloaded as .PDF file 
But Now you may face some problem as below :-

Bootstrap - Print layout and breaks after each grid column

Grid stacks when printing Bootstrap page

you may search How to Create Printable bootstrap page So solution is below

when you see in your print preview or .PDF file you can see bootstrap  layout will be not there . This is because bootstrap make the columns and rows by using some inbuilt classes these classes are by default included in bootstrap.min.css file but you have to set them to be allowed in all media As bydefault it is set to screen only

When you try code below in your html page you can see it is not printing your page with bootstrap enabled 

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src=""></script>
      <script src=""></script>
   <div class="container">
  <div class="row">
  <div class="col-md-6">Column1</div>
    <div class="col-md-6">Column2</div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src=""></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>

Steps To Create your Bootstrap Webpage Printable

1. Replace every col-md- with col-xs-
 e.g. :- replace every col-md-6 to col-xs-6 This is the thing that worked for me to get me rid of this problem you can see what you have to replace

Replace following code

   <div class="container">
  <div class="row">
    <div class="col-md-6">Column1</div>
    <div class="col-md-6">Column2</div>

With this code in our given example

<div class="container"> <div class="row"> <div class="col-xs-6">Column1</div> <div class="col-xs-6">Column2</div> </div> </div>

Friday, 1 August 2014

How To use Crystal Reports in

Download zip code file  for Crystal Report Demo App
Download Code For How To use Crystal Reports in

Setting Up Sql Server Database 

  1. Open you Sql Server Management Studio
  2. Connect to SQl Server
  3. Then  in Right panel Right click on Databases and Click on New Database
  4. Now A New Dialog Box Appears 
  5. Fill Database name: TestReports and Hit Enter . Now Table will be successfully created

  6. Now in the Query window execute the following scripts to create table

  7. After successfull creation of tables insert some dummy data in tables using following query code

  8. Now Our Database work is over Now we go to Visual Studio for code

Now Do Code in Visual Studio
Start your Visual Studio .Click on New project choose Web Form  Application and Give a appropriate name and choose location and Hit Enter .

Getting Dataset Ready For Report

  1. Right click on Project Folder in solution Explorer and click on Add then in further sub-menu click on New item

  2. Now a Popup window appears scroll and choose DataSet give name "Customers" and Click on Ok to add DataSet
  3. Now Customers Dataset will be added in solution explorer . Now Double click on it 
  4. It will open DataSet Designer Now right click on and create new DataTable 
  5. After Creating DataTable it will be empty by default now we will add column to it similar to our column in table in database 
  6. Right click on DataTable that we have created and Create new Column and give it name try to give the name similar to name of columns in Table in Database

Adding Crystal Report

  1. Right click on Project Folder in solution Explorer and click on Add then in further sub-menu click on New item 
  2. Now a Popup window appears scroll and choose Crystal Report give it name and Click on Ok

  3. Now Crystal Report Gallery window popup after some time 
  4. Now choose "Using the Report Wizard"  and click ok

  5. Now a window will popup and tell you to choose your dataset that we have created in above steps
  6. Choose your Datatable under Customers DataSet and Click ok
  7. Now your Dataset fields will be added on Field Explorer . Field explorer is available on left side of visual studio window
  8. In Field explorer under Database Expert you all datatable fields will be available

  9. you can drag these fields to crystal Report Details Section When you add them in  Details Section Its Header will automatically added to Page Header Section
  10. you can do some design of your Crystal Report like shown below :-

Designing Form

  1. Now  we will add a Aspx form that will be used to view our Crystal Report
  2. Right click on Project Folder in solution Explorer and click on Add then in further sub-menu click on New item 
  3. Now a Popup window appears scroll and choose WebForm give it name and Click on Ok  
  4. Now delete the existing code Add Following Code To Aspx Form

<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
    <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" Width="1000" />

Adding Csharp ( C# ) Code

  1. Now go to Csharp code of New Added Webform and Add code similar to code below :-
  2. Add this code under your partial class -- 

protected void Page_Load(object sender, EventArgs e)
        ReportDocument crystalReport = new ReportDocument();
        Customers dsCustomers = GetData("select * from Testtable");
        CrystalReportViewer1.ReportSource = crystalReport;

    private Customers GetData(string query)
        string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        SqlCommand cmd = new SqlCommand(query);
        using (SqlConnection con = new SqlConnection(conString))
            using (SqlDataAdapter sda = new SqlDataAdapter())
                cmd.Connection = con;

                sda.SelectCommand = cmd;
                using (Customers dsCustomers = new Customers())
                    sda.Fill(dsCustomers, "DataTable1");
                    return dsCustomers;