Why and Why not Asp.net 3.5 MVC? Asp.net 3.5 MVC Project series – Ist

1. What is MVC?
Answer: On of the most popular framework or we can say pattern is Model View Controller. It’s just like three tire architecture. This bifurcate our application in three different part or we can say layer which is presentation layer, business Layer and Data Access Layer.
Here we understand theree combination Model, View, Controller One by one.
As I mentiion above its three tier architecture design so here I explain why its three tire architecture.

1) View: – View is our presentation layer. Means what ever end user see or interact with our application is just View. In simple manner we can say it’s our forms either web or windows. If we taking about asp.net application or we application views are just our html Pages which we created normally. It’s not dependent on application Logic
2) Controller: – Controller is the part which decides which view should be render when user asks for some request. Or we can say it handle end user interaction.
Suppose I have requested “home.aspx” then its goes to controller and controller will decide which view he has to show to us. It’s our middle layer which we can business logic Layer.
3) Model: – Model is combination of our Database Layer + Business layer. It’s interacted with database like save, update, delete etc and also perform business logic.

So above are simple definitions for model view controller.
Now see below fig

mvc

In The figure you find three different entities. But there are some how dependent with each other
I will explain with the example let supposes a user request for customer data form.
Then the request first goes to controller and now controller is responsible to show a view
Suppose the view name is customerView.aspx then this view will be shown to the end user. Now what is the role of model here so model will provide data to view.

mvc1

Question: – why we use this?
Re use of code this first and most important advantage of MVC architecture. It’s single for web and windows we have to just change the views.

Suppose a company wants software of inventory on both windows and web then you don’t need to write whole code 2 times instead of this you have to write 2 views while model and controller will same for both. This is first and most important benefit.

multiplatformsupportmvc
Secondly Its give proper separation between presentation layer, Business layer and Data Layer.

As This blog is mainly for Asp.net and Sql Server so I will tell you for MVC dot net provide a new project template in Asp.net 3.5 which is Asp.net MVC project.
Now you thinking what earlier for previous version so here I will tell in earlier version dot net 1.1 Microsoft provide MUIAB (Microsoft User Inter Application Block) I will provide information an example for this in my next post.

Microsoft Asp.net 3.5 MVC project Support TDD (Test Driven Development) this is another most useful feature.

MVC use core html control which we used in asp classic (3.0) like Input, button so it is much faster then our web form application.

Microsoft Asp.net 3.5 project use URL is such a way which helpful in SEO (Search Engine Optimization).

Question: – why we don’t use it?
Again it’s depend on person to person according to there requirements or there preference that whether he want to use this pattern or not. According to me (as my experience and read from other articles) there is few disadvantage of using it.
The first and most important disadvantage which I feel is limitation in controls in direct use. There are many server controls link data Grid, List control which we used in web form project can not use directly in MVC project.
Lot of work in pure HTML which is some time irritating for the programmer who earlier works on asp. Net’s web form application with server controls.

In Next article we read basic of MVC (Model View Controller). Advantage & Disadvantage. In Next Session. I come with the example how we create a simple MVC project with asp.net 3.5
Till than friends do take care your self
Enjoy dot net
Enjoy MVC

Thanks & Esteemed Regards
From one and only one your Host 🙂
Rajat Jaiswal

Advertisements

How to import CSV in dotnet or direct Sql Server in 5 minutes?

Hello Friends,
Many times we require a logic by which we can import a csv file in grid or database.So don’t worry its not a big issue now For this I am taking below example this example is in VB.net (windows application)
Suppose I have csv file with following values
“ADDRESSID,ACCOUNTNO,ADDRESSTYPE,CODE,NAME,COMPANYNAME,ADDR1,ADDR2,ADDR3,
ADDR4,CITY,STATE,PROVINCE,ZIPCODE,POSTALCODE,COUNTRY,PHONENO,
EXTENSION,NOTIFICATIONEMAIL”
Or we can say above is the column name in this order the csv file is arrange.
So first what we do we just read the file for this
Me.OpenFileDialog1.Multiselect = False
Me.OpenFileDialog1.ShowDialog()
Me.txtPath.Text = Me.OpenFileDialog1.FileName
Dim sReader As New StreamReader(Me.txtPath.Text)
Dim strFile As String = sReader.ReadToEnd
sReader.Close()

Now in next step what we do we create a table with column which are exist in csv file remember we have to use same order for this we will write following code
Dim tbl As New DataTable
tbl.Columns.Add(New DataColumn(“ADDRESSID”))
tbl.Columns.Add(New DataColumn(“ACOUNTNO”))
tbl.Columns.Add(New DataColumn(“ADDRESSTYPE”))
tbl.Columns.Add(New DataColumn(“CODE”))
tbl.Columns.Add(New DataColumn(“NAME”))
tbl.Columns.Add(New DataColumn(“COMPANYNAME”))
tbl.Columns.Add(New DataColumn(“ADDR1”))
tbl.Columns.Add(New DataColumn(“ADDR2”))
tbl.Columns.Add(New DataColumn(“ADDR3”))
tbl.Columns.Add(New DataColumn(“ADDR4”))
tbl.Columns.Add(New DataColumn(“CITY”))
tbl.Columns.Add(New DataColumn(“STATE”))
tbl.Columns.Add(New DataColumn(“PROVINCE”))
tbl.Columns.Add(New DataColumn(“ZIPCODE”))
tbl.Columns.Add(New DataColumn(“POSTALCODE”))
tbl.Columns.Add(New DataColumn(“COUNTRY”))
tbl.Columns.Add(New DataColumn(“PHONENO”))
tbl.Columns.Add(New DataColumn(“EXTENSION”))
tbl.Columns.Add(New DataColumn(“NOTIFICATIONEMAIL”))

One this done then what we do we read all the rows one by one and split it with comma seprated value and create row in our table.
Dim strReadLine() As String = Split(strFile, vbCrLf)
The above line just convert single line in multiline with delimiter Vbcrlf which means Line break
One this done then we have collection of individual row in same format in our variable strReadLine
Now we read each line from strReadLine and create new row in table column
For intCount As Integer = 1 To strReadLine.Length – 1
Dim strColumn() As String = strReadLine(intCount).Split(“,”)
Dim DataRow As DataRow = tbl.Rows.Add()
For intCol As Integer = 0 To strColumn.Length – 1
DataRow(intCol) = strColumn(intCol)
Next
Next
Me.dgv.DataSource = tbl

So in this way we import a csv file and bind that files value in a dataGrid.

Friends if you don’t want to use vb.net and want directly import csv file in SQL Server then SQL Server support a unique sql command which is Bulk Copy
Suppose the file we have to import directly in a table which having this column then we have to write follow lines

BULK
INSERT tblImportTest
FROM ‘c:\rajat.txt’
WITH
(
FIELDTERMINATOR = ‘,’,
ROWTERMINATOR = ‘\n’
)
GO

So I think friends the above code solve our problems in many ways hope you like article.
You can download code from http://www.indiandotnet.tk

Thanks
Enjoy codeing, Enjoy dot net 😀
Rajat

Multi Language web site in 5 easy steps in 5 minutes

Hello friends,
Here I am with a new topic Localization Globalization. Most of the time our client require website which support multi language so in that case we have to do some extra effort. Asp.net provides simplest way of how to do this. So friends I am explaining you 5 minimum steps which help us to make a website multi language.
I am talking my favorite 3 languages Hindi, English, Spanish.
So here we go
Step 1:- The first basic step you have to create a resource file which will be your default resource file for your project.
To create resource file you have to open your file then select menu option Tool –> Generate Local resource as shown in below fig

localization1

As you done with this option what you will see that in your solution explore a new folder is added with name “App_LocalResources” which having the file name extension “.resx” means suppose if you have open default.aspx file and you say generate local resource then you will get “default.aspx.rsex” in app_LocalResouce Folder. This will be your default Resource file.
When you open this file you will find. Name & Value & comment column.
Here Name is related with your page control and what should be the value for this controls will be exist in your value column.
For me by default it’s English so there is no issue for English.
Step 2:- Create new resource file for Hindi. For this we will do just copy and paste existing resource file and rename that file and replace the value which we want in Hindi or Spanish. See below fig for it

hindirex

The things to remember here that when you saving particular language file then the language code should be there for example if I am using Spanish language then my file name will be “Default.aspx.en.resx”
And for Hindi my file name will be “Default.aspx.hi.resx”

englieshrex

spanishrex

Step3:- when you see your file default.aspx then you will find there is extra text with each of your control which is resource key.
For example see below lines here we have resource key lblWelcomeMessageResouce1 this should be present in our resource file. At run time dot net get the value from this key.

  <asp:Label ID=”lblWelcomeMessage” runat=”server” Text=”Hello and welcome “                meta:resourcekey=”lblWelcomeMessageResource1″></asp:Label>

And for drop down we having following code
<asp:DropDownList ID=”ddlLanguage” runat=”server”

                    meta:resourcekey=”ddlLanguageResource1″>

                    <asp:ListItem Text=”English” Value=”en-US” Selected=”True”

                        meta:resourcekey=”ListItemResource1″></asp:ListItem>

                    <asp:ListItem Text=”Hindi” Value=”hi-IN” meta:resourcekey=”ListItemResource2″></asp:ListItem>

                    <asp:ListItem Text=”Spanish” Value=”es-MX” meta:resourcekey=”ListItemResource3″></asp:ListItem>

                </asp:DropDownList>

Step 4: I have design my page as shown below.

pagedesign

We have to look for two basic namespace here one is Resource and another is globalization.

Once you done with the above step now you have to set the culture according to your chosen value from drop down.
For that we have to write following code
Protected Overrides Sub InitializeCulture()
Try
Dim _culture As String = Session(“Language”)
If _culture <> String.Empty Then
Dim ci As New System.Globalization.CultureInfo(_culture)
System.Threading.Thread.CurrentThread.CurrentCulture = ci
System.Threading.Thread.CurrentThread.CurrentUICulture = ci

End If

MyBase.InitializeCulture()
Catch ex As Exception
Throw ex
End Try
End Sub ‘InitializeCulture

Its just override your base class seating. In session we are putting value we have selected in drop down.
On button click event we assign the value (selected dropdown value) in the session.
In this way we get multi language web page.

Step 5:- Just run it 😀

runningmode

In this way we have finished our minor task
You can download code from http://www.indiandotnetmultilanguagework.tk/

In next few days I will come back with more solid presentation.
Till than
Do Take Care your self
And enjoy coding..

Simplest PayPal Integration with asp.net in 5 steps

Hello friends,
In Today’ Scenario PayPal is well known name, so its not need any introduction.
I know after reading title you are excited to know how to integrate PayPal in your website. First thing I declare here there different technique, different ways of using PayPal so it’s up to you what way you like to integrate. I am using here with simplest way. Just follows the steps.
Step 1: PayPal provide lot of thing for developer to integrate PayPal in developer web site. Here our first step is to create a developer account on PayPal so we can test it.
For that just login on PayPal Site  https://developer.paypal.com

Just create your account over here create a buyer and seller account for testing.
PayPal provide Sandbox site for testing.

A buyer account use for buy something from your site (On Sandbox)
And Seller account use for Sell Something to your buyers on your site means your shops account (for testing on Sandbox)

Step 2:- Once you have done with creating Sandbox work then here we take a task suppose I am a bike seller and I am selling bikes online then I have following page to show bikes
From here user can buy any bike on my site.
And he can do payment by paypal. For this we used PayPal image which you can get by https://www.paypal.com/en_US/i/btn/x-click-but01.gif
You can find much option as your requirement.

product

Here we did code for each image button for this I have made a session which keep bike information with name, price and description.

Public Class pub_clsCommon
Public Const _strBikeSession As String = “BIKESESSION”
End Class
_
Public Class pub_clsBikeInfo
Public lngId As Integer
Public strBikeName As String
Public strBikePrice As Decimal
Public strBikeDescription As String
End Class

Step 3:-
On button click we fill this session as shown below.
Private Sub imgBike5_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgBike5.Click
Try
clsSession = New pub_clsBikeInfo
clsSession.lngId = 5
clsSession.strBikeName = “Harley Davidson Model#005”
clsSession.strBikePrice = Me.lblPrice5.Text
clsSession.strBikeDescription = Me.lblDescription5.Text
Session(pub_clsCommon._strBikeSession) = clsSession
Response.Redirect(“PayPalIntegration.aspx”)
Catch ex As Exception
Throw ex
End Try
End Sub ‘imgBike5_Click

Once this done we go for Second page which is PayPalIntegration.aspx.
Step4:-The payPalIntegration.aspx is the main page from this page we interact with PayPal.
On this form we are using Action =”https://www.sandbox.paypal.com/cgi-bin/webscr&#8221;

which is basically paypal sandbox address and it’s for testing basically.

We have to send some require fields which are necessary for PayPal as hidden variables.
These hidden fields are like
1) Business: – in this yours PayPal business id save like “xyz@xyz.com”
2)cmd :- in this we put value “_cart”
3)Currency_code:- like USD Or other
4)Item_Name_N :- Where n is Item number sequence like 1,2,3. This will keep Item Name
5)Item_description_N :- where n is the item number Sequence like 1,2,3.This will keep Item Description
6)Amount_N :- Where n is the item number Sequence like 1,2,3. This will keep item amount
Similarly we can assign shipping, notes and other variables if required.

Step 5:- once we done with this fields we just post this form after updating item description, name, and amount as our need.
In this way we can use paypal integration in simplest manner.

You can see test code at http://indiandotnetWithPayPalIntegration.tk

and also download code from
https://skydrive.live.com/embed?cid=1EDA2012469FF8AD&resid=1EDA2012469FF8AD%21244&authkey=ALELSIiAsy9lJiQ
For more detail you can visit  https://developer.paypal.com

I hope you understand the basic. I will come up with further operation in coming up session till then
Thanks a lot
Enjoy coding
Enjoy programming 🙂

Yours truly, Host
Rajat Jaiswal

How to add AJAX tab control at run time?

 Hello friends,
Today we will discuss how to add Ajax tab control at run time.

As you know for adding tab control in our page we require two Ajax controls one is AJAX Tab Container and second is AJAX tab Panel control.
AJAX tab container is main control and Tab Panel is child control. Now you have to follow step as follow.

Step 1:-
For this first just drag drop a Tab Container on our aspx page.

Step 2 :- Now you have to add panel in tab container for that we have to work in special method of tab Container which is tab Initialize method.
It means you have to work in below event.
Private Sub tabCont_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabCont.Init
Try
Me.pvt_DefineTabControl()
Catch ex As Exception
Throw ex
End Try
End Sub
Here I have created a Define tab control method in which we define tab control at run time.
According to my knowledge if you do not use this tab initialize method than you can not use run time control creation. So this event is must when you creating run time tab control

Step3 :- you are thinking what is pvt_DefineTabControl method so it’s a simple work as you see below.
Private Sub pvt_DefineTabControl()
Try
If Me.tabCont.Tabs.Count > 0 Then
Me.tabCont.Tabs.Clear()
End If
If Session(“Counter”) Is Nothing OrElse Trim(Session(“Counter”)) = String.Empty Then
Session(“Counter”) = 1
End If
For intI As Integer = 0 To CInt(Session(“counter”)) – 1
Dim tabPan As New TabPanel
Dim btnPanelNumber As New Button
btnPanelNumber.ID = “btnPanel” & intI.ToString
btnPanelNumber.Text = “Click me to create Panel ” & (intI + 1).ToString
AddHandler btnPanelNumber.Click, AddressOf MyButtonClick
tabPan.Controls.Add(btnPanelNumber)
tabPan.HeaderText = “Panel” & intI.ToString
Me.tabCont.Controls.Add(tabPan)
Next
Catch ex As Exception
Throw ex
End Try
End Sub
Step 4: here I have added one Button in Tab Panel for this I used a common Click event handler which is MyButtonClick
By default there is a single TabPanel when you click button in tab Panel then you will get next panel.
Private Sub MyButtonClick(ByVal sender As Object, ByVal e As System.EventArgs)
Try
Session(“Counter”) = Session(“Counter”) + 1
Dim strButtonId As String = CType(sender, Button).ID
Dim intId As Integer = CInt(strButtonId.Replace(“btnPanel”, 0))
Me.pvt_DefineTabControl()
Me.tabCont.Tabs(intId).HeaderText = “You have Clicked me” + intId.ToString + “Panel’s Button”
Catch ex As Exception
Throw ex
End Try
End Sub

Step 5:- For Example you can visit on http://indiadotnetajaxtabwork.tk/

and download code also.

Thanks & Regards
Rajat
Enjoy Coding 🙂
Enjoy Ajax tool kit 🙂

Google chart with me in 5 minutes

Dear Friends,
After using MS Chart I am just wondering on net for more charting examples and articles in searching part I just found google chart.
I just thought let try it so here I am with a sample application which will give you an overview how google charting work.
The First and most important thing in google charting is its url.
Google chart provide you many chart type and its easy to use also.
Lets start with main url for google chart http://code.google.com/apis/chart/basics.html
Now the intresting thing is querystring variables which we passed with this url we start one by one here.
1) Chs :- The first part is chs. By the name you can understand that it means chart size. Here you can put your chart size in pixel like 200*300 etc.
2)cht:- Another most important variable in cht by the name you can understand that it means chart type. You can assign following value for chart type 1) cht = (lc,ls,lxy) its used for line chart
2) cht = (bhs,bvs,bhg,bvg) its used for Bar charts
3) cht = (p,p3,pc,chp) Pie chart
4) cht = (v) venn diagram
5) cht = (s) Scatter ploting chart
6) cht = (r,rs) Radar charts
7) cht =(gom) another itresting part (Google -o-meters)

3)chd :- By the name you can understand that its charting data or we can say that series.For this google has provided mainly 3 data format by which we can send data
1) text formating (Used as chd = t: series values)
2) Simple fomating (used as chd = s:series values)
3) Extended encoding (used as chd= e: series values)

4) cht:- its means chart type you can define chart title with this option.
5) chl:- you can define chart label with this.
You can put specific axis label by using it for example chxt = x,y,r,t
For more detail you can visit http://code.google.com/apis/chart/labels.html#chart_legend

With this require variables you can easily plot a graph..
Lets try with the example which we have taken in my earlier post (“Introduction of Microsoft Chart control in 5 minutes Part -Ist”)
Same salary saving structure if we have to show in pie chart with 3d effect then

You can view samplet at and download code also.
http://www.indiandotnetwithgooglechart.tk
enjoy google chart
Enjoy asp.net programming.
Thanks
Rajat Jaiswal

Introduction of Microsoft Chart control in 5 minutes Part -IInd

 Hello friends,
In last post I just promised that I will come with example. So here I am with the second part of our topic which is “Introduction of Microsoft chart control in 5 minutes”
Friends you don’t believe that but MS Chart control is very powerful control and I am still working on it for best output, for basic understand lets take a problem for which we have to show a graph
I am not going here for a big task. So here we go.
Suppose we want to show our friends extra saving of month April (I know today is 1’st April and in today’s era saving is just big problem for middle class families but hope this much extra saving done in there pocket.)
For this data is as below.

Sr. No           Friends                Saving
1                      Rajat                     5700
2                     Ashish                  12000
3                     Kapil                      4800
4                    Ravi                         7000
5                    Monica                  6000
6                   Kamlesh                3000
7                  Seepee                   9000

So we are ready with data and now we want to show chart related this. So just follow below steps.
Step 1:- Open a new project and include MS Chart control on your toolbox list
You can find the control reference path at “C:\program Files\Microsoft Chart Controls\Assemblies”
When you done with this just drag drop the chart control on your page.

Step 2:- Once you done with this you will find following changes in web Config or you can say this extra lines will be automatically added.
This is the assembly required for chart is added.

And if you don’t know then I will tell you that the output of the chart control is an image so there for here is image handles. (You can get PNG, JPEG etc format)

 

The below setting is used for default Storage of image which will created at run time. URL is virtual path here. And timeout is just use for time duration after that time image will delete automatically.
Step 3:- In a simple chart there are mainly two things which is X –Axis, Y- Axis
We can arrange interval of both X- Axis and Y-Axis by an in line control which is provide by MS Chart control.

Suppose I want my friends name on X- Axis then I have to add custom label control for that. As shown below figure.

A chart control having mainly Title, Legend, Series, and chart area nodes.
Below is our html part of page.
You will see here title, legend, series and chart area.

graphdescription

Step 4:- Just drop a dropdown control for chart type. MS chart control provides 34 different charting types. We just bind the dropdown with this charting type.

Step 5:- Write down code for bind dropdown with chart control.
Private Sub pvt_BindDropDownList()
Try
Me.ddlChartType.Items.Clear()
Me.ddlChartType.Items.Add(New ListItem(“AREA”, SeriesChartType.Area))
Me.ddlChartType.Items.Add(New ListItem(“Bar”, SeriesChartType.Bar))
Me.ddlChartType.Items.Add(New ListItem(“BoxPlot”, SeriesChartType.BoxPlot))
Me.ddlChartType.Items.Add(New ListItem(“Bubble”, SeriesChartType.Bubble))
Me.ddlChartType.Items.Add(New ListItem(“CandelStick”, SeriesChartType.Candlestick))
Me.ddlChartType.Items.Add(New ListItem(“Column”, SeriesChartType.Column))
Me.ddlChartType.Items.Add(New ListItem(“Doughnut”, SeriesChartType.Doughnut))
Me.ddlChartType.Items.Add(New ListItem(“ErrorBar”, SeriesChartType.ErrorBar))
Me.ddlChartType.Items.Add(New ListItem(“FastLine”, SeriesChartType.FastLine))
Me.ddlChartType.Items.Add(New ListItem(“FastPoint”, SeriesChartType.FastPoint))
Me.ddlChartType.Items.Add(New ListItem(“Funnel”, SeriesChartType.Funnel))
Me.ddlChartType.Items.Add(New ListItem(“Kagi”, SeriesChartType.Kagi))
Me.ddlChartType.Items.Add(New ListItem(“Line”, SeriesChartType.Line))
Me.ddlChartType.Items.Add(New ListItem(“Pie”, SeriesChartType.Pie))
Me.ddlChartType.Items.Add(New ListItem(“Point”, SeriesChartType.Point))
Me.ddlChartType.Items.Add(New ListItem(“PointAndFigure”, SeriesChartType.PointAndFigure))
Me.ddlChartType.Items.Add(New ListItem(“Polar”, SeriesChartType.Polar))
Me.ddlChartType.Items.Add(New ListItem(“Pyramid”, SeriesChartType.Pyramid))
Me.ddlChartType.Items.Add(New ListItem(“Radar”, SeriesChartType.Radar))
Me.ddlChartType.Items.Add(New ListItem(“Range”, SeriesChartType.Range))
Me.ddlChartType.Items.Add(New ListItem(“RangeBar”, SeriesChartType.RangeBar))
Me.ddlChartType.Items.Add(New ListItem(“RangeColumn”, SeriesChartType.RangeColumn))
Me.ddlChartType.Items.Add(New ListItem(“Renko”, SeriesChartType.Renko))
Me.ddlChartType.Items.Add(New ListItem(“Spline”, SeriesChartType.Spline))
Me.ddlChartType.Items.Add(New ListItem(“SplineArea”, SeriesChartType.SplineArea))
Me.ddlChartType.Items.Add(New ListItem(“SplineRange”, SeriesChartType.SplineRange))
Me.ddlChartType.Items.Add(New ListItem(“StackedArea”, SeriesChartType.StackedArea))
Me.ddlChartType.Items.Add(New ListItem(“StackedArea100”, SeriesChartType.StackedArea100))
Me.ddlChartType.Items.Add(New ListItem(“StackedBar”, SeriesChartType.StackedBar))
Me.ddlChartType.Items.Add(New ListItem(“StackedColumn”, SeriesChartType.StackedColumn))
Me.ddlChartType.Items.Add(New ListItem(“StackedColumn100”, SeriesChartType.StackedColumn100))
Me.ddlChartType.Items.Add(New ListItem(“StepLine”, SeriesChartType.StepLine))
Me.ddlChartType.Items.Add(New ListItem(“Stock”, SeriesChartType.Stock))
Me.ddlChartType.Items.Add(New ListItem(“ThreeLineBreak”, SeriesChartType.ThreeLineBreak))
Catch ex As Exception
Throw ex
End Try
End Sub

Step 6:- Write code for Bind Graph..
Private Sub pvt_BindChart()
Try
Me.ctrlChart.Legends(0).Title = “Friends Saving”
Dim ArrList As New ArrayList
ArrList.Add(“Rajat”)
ArrList.Add(“Ashish”)
ArrList.Add(“Kapil”)
ArrList.Add(“Ravi”)
ArrList.Add(“Monica”)
ArrList.Add(“Kamlesh”)
ArrList.Add(“seepee”)
Dim dblFrom As Double = 0.5
Dim dblTo As Double = 1.0
For intI As Integer = 0 To ArrList.Count – 1
Dim lbl As New CustomLabel
lbl.FromPosition = dblFrom
lbl.ToPosition = dblTo
lbl.Text = ArrList(intI)
Me.ctrlChart.ChartAreas(0).AxisX.CustomLabels.Add(lbl)
dblFrom = dblTo
dblTo = dblTo + 1
Next
Me.ctrlChart.Series(0).Points.AddXY(1, 5700)
Me.ctrlChart.Series(0).Points.AddXY(2, 12000)
Me.ctrlChart.Series(0).Points.AddXY(3, 4800)
Me.ctrlChart.Series(0).Points.AddXY(4, 7000)
Me.ctrlChart.Series(0).Points.AddXY(5, 6000)
Me.ctrlChart.Series(0).Points.AddXY(6, 3000)
Me.ctrlChart.Series(0).Points.AddXY(7, 9000)
Me.ctrlChart.ChartAreas(0).AxisX.Interval = 1
Me.ctrlChart.ChartAreas(0).AxisX.ArrowStyle = AxisArrowStyle.SharpTriangle
Me.ctrlChart.ChartAreas(0).AxisY.ArrowStyle = AxisArrowStyle.SharpTriangle
Me.ctrlChart.Series(0).ChartType = Me.ddlChartType.SelectedValue

Me.ctrlChart.Series(0).CustomProperties = “DrawingStyle=Cylinder”

Catch ex As Exception
Throw ex
End Try
End Sub ‘pvt_BindChart

barchart

Step 7:- Now run the code you will get below output as shown in figures.
Step 8:-you can download code from http://www.indiandotnet.tk
In Next blog we will discuss comparing 2 month salary of these peoples.

splinechart

I hope it will helpful for you people next time I will come with more description and code till than enjoy coding enjoy graphs.

Thanks
Rajat Jaiswal