Category Archives: PDF

PDF

[RESOLVED]Download form to Pdf on button click

Can anyone help me download the selected form on button click to pdf  in MVC ….

or anyother way to do it.

So you need to convert a form to PDF?  I use the NuGet package "Rotativa" to convert anything to PDF.  There’s good documentation on it as well

http://www.codeproject.com/Articles/335595/Rotativa-how-to-print-PDF-in-Asp-Net-MVC

How to add it in my project???

can u suggest me pls

?

You can use Nuget to install it. Go to the Nuget console manager and run the command (as mentioned in the post)

Install-Package Rotativa

For information on how to run Nuget from console see the below post

http://docs.nuget.org/docs/start-here/Using-the-Package-Manager-Console

i have installed Rotativa in my project..

but i m not able to proceed furthur;

can u provide me with sample video for downloading form on button click

Try downloading the demo from the site and run it

https://github.com/webgio/Rotativa/tree/master/Rotativa.Demo

I m getting this error how do i resolve it?

Error 19 The type or namespace name ‘ControllerContext’ could not be found (are you missing a using directive or an assembly reference?) E:PersonalInformationLearningAjaxRotativa-PartialViewAsPdfRotativa-PartialViewAsPdfRotativaAsPdfResultBase.cs 229
44 Rotativa

Can you explain little bit more on what you want to do on the button click. What data you want to convert into pdf and where does this data reside?

Also are you ok with use commercial products which will simplify your work?

I have two buttons on everypage when i view data of a particular client …..print button and download button//…..

print is ok…

now i need code for downloading the particular html page to pdf ……

can u help me with this?

Is it ok to pass your data to a third party website which converts your page to pdf. If yes try this

<a href="javascript:void(window.open('http://www.htmltopdfconverter.net/?convert='+window.location))">Convert To PDF</a>

Also check this stack overflow
convert HTML ( having Javascript ) to PDF using java / javascript

[RESOLVED]How to get started with ASP.NET MVC ?

I’ve learned ASP.NET 2-3 years ago and I’d made some projects on ASP.NET. Now It feels like I can improve them little bit. As I’ve some 15 days free, So I was thinking to learn something new and use it in my old projects.

Actually there are some areas in my projects where I’ve to design new tools which is not possible with ASP.NET alone. For example I’m having "Virtual Classroom Project" and there is a tool called "White Board" which allow Professor to explain the things
to students. I was going to start learning Silverlight then some of my friends suggested me of ASP.NET MVC.  I’m new to ASP.NET MVC and don’t know anything about it.

How it is different from ASP.NET ?
What features does it offers ?
Whats the future of it ?
How much ASP.NET MVC coding is different from ASP.NET ?
How much time will it take to learn ASP.NET MVC ?

I’d suggest to spend 1 hour of 15 days to google all 5 questions.

Spend an hour or two and walk through this beginner’s tutorial:

http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-1

this tutorial covers most of the basics for MVC.  Please note that this tutorial is slightly dated — I believe it’s more for MVC 3 than 5, however the same principles still apply.

MVC Resources

The Getting Started MVC area on this site is a great place to start as well if you want to start learning MVC outside of a book environment. It will cover just about everything that you would need to build complete applications
and it is written by experts that apply best practices to help you build good habits for future applications.

One of the most well regarded and complete MVC-based tutorials would be the ASP.NET MVC Music Store tutorial, which you can find under the MVC section of this site. However, any
of the tutorials on this site
 should be great stepping stones to get you building your own complete MVC applications in no time.

You can find a few other resources listing off countless other MVC-based tutorials below: 

or the following more architecturally based examples :

I would definately recommend the MVC Music Store Tutorial as well as the other ones available on this site (ASP.NET) and if you are still looking for more information after that, check out some of the other links I provided. If you are still looking
for some additional tutorials or other MVC based projects, you might want to dig around on open-source sites like github and Codeplex and search for a bit more complex sites and projects.

Regarding Your Questions

22990atinesh

How it is different from ASP.NET ?

Technically, ASP.NET is still based on the same framework as Web Forms (which I am assuming that you are referring to in this context). MVC just provides a different pattern and approach to developing your applications. It is patterned after the
web and thus is stateless (so you don’t have a ViewState or any Controls). Due to it’s nature, it lends itself well to separating your concerns (all of your Presentation-related code is within the Views, your business logic will be within your
models and your Controllers will handle your data access
).

22990atinesh

What features does it offers ?

It doesn’t necessarily "offer" any newer features. Some might argue that it can be tested more easily than Web Forms (if you actually are one of the people out there writing tests consistently). I personally find it to be much simpler than Web Forms in a
very "bare-bones" sense.

22990atinesh

Whats the future of it ?

Bright. MVC has really taken off since it’s release and is continuing to gain more and more steam for developing Microsoft Web Applications. Web Forms is still completely relevant and will continue to play a major role, but MVC is certainly catching up.

It’s worth learning.

22990atinesh

How much ASP.NET MVC coding is different from ASP.NET ?

As I mentioned earlier, there are quite a few learning curves associated with it. The lack of "Controls" can be tough for those migrating from Web Forms as can the lack of a state. Since controls don’t exist, it requires developers to be much more comfortable
with using pure HTML and Javascript to accomplish many of the things that their controls did previously. 

22990atinesh

How much time will it take to learn ASP.NET MVC ?

This is something that depends entirely on you and how quickly you can understand the different components of an MVC application and how they work together. The tutorials mentioned earlier should help with this.

22990atinesh

there is a tool called "White Board" which allow Professor to explain the things to students

SignalR is a good fit for your whiteboard application. Please take look at these posts

Online
Whiteboard using HTML5 and
SignalR

A SignalR Whiteboard

22990atinesh

As I’ve some 15 days free, So I was thinking to learn something new and use it in my old projects.

I recommend learning AngularJS. It is getting more traction now-a-days. You can use MVC/WebAPI with AngularJS

Rion Williams

MVC Resources

The Getting Started MVC area on this site is a great place to start as well if you want to start learning MVC outside of a book environment. It will cover just about everything that you would need to build complete applications
and it is written by experts that apply best practices to help you build good habits for future applications.

One of the most well regarded and complete MVC-based tutorials would be the ASP.NET MVC Music Store tutorial, which you can find under the MVC section of this site. However, any
of the tutorials on this site
 should be great stepping stones to get you building your own complete MVC applications in no time.

This is something that depends entirely on you and how quickly you can understand the different components of an MVC application and how they work together. The tutorials mentioned earlier should help with this.

Thanx for help Now I can start learning ASP.NET MVC.

How is ASP.NET Web Pages, Is it better than ASP.NET MVC. Is it possible create tools that I asked for with ASP.NET Web pages. 

ASP.NET Web pages are completely different than MVC.If you are strong with HTML concepts you may be able to learn it quickly.

22990atinesh

How is ASP.NET Web Pages, Is it better than ASP.NET MVC. Is it possible create tools that I asked for with ASP.NET Web pages. 

Neither are necessarily better than the others, they are different patterns / technologies that both can be used to create Web Applications. Web Pages can be thought of as a more entry-level technology (not to say that it cannot be used to build complex
Web Applications
) whereas MVC encompasses a much larger set of libraries and in general more complex (which might be overkill for something as simple as a Web Site).

Both can create Web Applications, which is ultimately what your goal is, so either might be worth exploring as an option.

Rion Williams

22990atinesh

How is ASP.NET Web Pages, Is it better than ASP.NET MVC. Is it possible create tools that I asked for with ASP.NET Web pages. 

Neither are necessarily better than the others, they are different patterns / technologies that both can be used to create Web Applications. Web Pages can be thought of as a more entry-level technology (not to say that it cannot be used to build complex
Web Applications
) whereas MVC encompasses a much larger set of libraries and in general more complex (which might be overkill for something as simple as a Web Site).

Both can create Web Applications, which is ultimately what your goal is, so either might be worth exploring as an option.

I’ve tried ASP.NET MVC, It’s a totally new concept. I’ll learn it in the future. For now I just want to create a "White Board tool" which should be capable of displaying PPT, PDF, have Simple Drawing tool and a chat box. Can I do it with the help of HTML
5 + Jquery + CSS

22990atinesh

I’ve tried ASP.NET MVC, It’s a totally new concept. I’ll learn it in the future. For now I just want to create a "White Board tool" which should be capable of displaying PPT, PDF, have Simple Drawing tool and a chat box. Can I do it with the help of HTML 5
+ Jquery + CSS

You’ll likely need to use some kind of server-side code in order to properly retrieve your various types of files (unless they are explicitly stored in the same directory as your project and you would be accessing them through links). Additionally,
most browsers are not going to be able to "display" files like PowerPoint natively, you’ll need to look into a library as a way to present these within the browser (although there are other
ways to embed a PowerPoint presentation within your web application
).

Finally, a drawing tool shouldn’t be too out of reach as it’s very commonly implemented using the HTML <canvas> element along with a bit of Javascript / jQuery. If you search around for it, you shouldn’t have too much trouble finding a simple HTML5 Drawing
implementation. There are quite a few "it depends" answers related to a project like this and I am sure that you should be able to accomplish something like it using either a pure HTML5 / Javascript implementation or one that leverages ASP.NET (either
Web Pages or MVC
).

zing!

22990atinesh

Can I do it with the help of HTML 5 + Jquery + CSS

Have you looked at my earlier links?

Online
Whiteboard using HTML5 and
SignalR

A SignalR Whiteboard

Let’s see videos to understand about MVC .NET. You can understand some things

http://youtu.be/lG49gPy-hG0

http://youtu.be/ZKYlK4RFa1I

http://youtu.be/-ZdgU8Hngxw

Hi,

Please use below link to know about basic MVC history, basic, business section are same what we had been used in ASP.Net. 

http://www.asp.net/mvc

http://mvc4beginner.com/Tutorial/

http://msdn.microsoft.com/en-us/vs2010trainingcourse_aspnetmvc3razor.aspx

http://20fingers2brains.blogspot.com/2014/01/introduction-to-aspnet-mvc-3.html

http://www.microsoftvirtualacademy.com/training-courses/introduction-to-asp-net-mvc

Please don’t rush to learn short time, please work out what you learn day by day.

Thanks,

Jai.

Rion Williams

22990atinesh

I’ve tried ASP.NET MVC, It’s a totally new concept. I’ll learn it in the future. For now I just want to create a "White Board tool" which should be capable of displaying PPT, PDF, have Simple Drawing tool and a chat box. Can I do it with the help of HTML 5
+ Jquery + CSS

You’ll likely need to use some kind of server-side code in order to properly retrieve your various types of files (unless they are explicitly stored in the same directory as your project and you would be accessing them through links). Additionally,
most browsers are not going to be able to "display" files like PowerPoint natively, you’ll need to look into a library as a way to present these within the browser (although there are other
ways to embed a PowerPoint presentation within your web application
).

Finally, a drawing tool shouldn’t be too out of reach as it’s very commonly implemented using the HTML <canvas> element along with a bit of Javascript / jQuery. If you search around for it, you shouldn’t have too much trouble finding a simple HTML5 Drawing
implementation. There are quite a few "it depends" answers related to a project like this and I am sure that you should be able to accomplish something like it using either a pure HTML5 / Javascript implementation or one that leverages ASP.NET (either
Web Pages or MVC
).

Hello Rion William,
I’ve read SignalR articles from official ASP.NET website. Its a very cool and easy concept. A simple "Chat box" App requires only few lines of code (hardly 7-8 lines of code after adding the SignalR library) and its quite self explanatory. And Ya HTML 5 canavas
is also easy way to create white board. I can combine these two to make a simple White board tool, But I’m trying to build a more advanced white board tool with more flexibility and more featues. Please see this post

http://forums.asp.net/t/2012233.aspx?What+you+can+and+can+not+do+with+ASP+NET+SignalR+

Pro ASP.NET MVC 5

[RESOLVED]using RDLC in MVC projects

We have a MVC 4.0 project and for reporting we used RDLC. We need to have the reportviewer control available in client page, because we want our web application to be very similar with a desktop application.

To work with RDLC we have to use aspx pages inside our project which are loaded inside iframe based on src=… path.

We store these files in Reports folder inside our project.

Everything was working in our development process. We use Visual Studio 2013 with IIS Express.

When we have done the deployment to the production server, we observe that our reports are not working. We receive the 404 error. We have received the same 404 error from Windows Server 2008 SBS and from Windows Server 2012 Standard where we have made the
deployment

Please help us with this issues.

Thank you very much

You may look into using the Reports as "Local Reports" and simply using MVC to render them via their path (instead of navigating to them directly, which would require routing changes). I recently implemented a similar structure to support accessing
data via Entity Framework to populate to populate a few RDLC Reports that I had created. Although this may not be exactly the approach that I took, I would recommend

taking a look at this blog post on the topic
.

If you don’t want to take that approach and would prefer to render an actual Report Viewer directly within an MVC View (or navigate to an ASPX page that contained your report), you might be better off using an approach
like this one.

Hi horia,

First, please refer to Rion’s reply.

Secondly, please use
Server.MapPath
to generate the path dynamically.

On the other hand, there are some articles about report that can help you:

# ASP.NET MVC Html Helpers for ReportViewer Control.

https://github.com/ilich/MvcReportViewer

# Prototype MVC4 Razor ReportViewer? RDLC

http://www.codeproject.com/Articles/609580/Prototype-MVC-Razor-ReportViewer-RDLC

Best Regards

Starain Chen

if you have internet explorer greater than I.E 8. There is something called developer tools (press F12). on network tab you can start monitoring.

Find the url which is giving 404. Hit the url separately from new tab in the browser, check if you are getting the same 404.

Find the url which is working in you dev environment, get the url from there. Find the difference between working and non working url. It could be because of cross posting, domain bieng different, url bieng wrong, insufficient file permission for files in
reports folder. If there are physical file, you might also want to set it up as static file at IIS level or in web.config

In the first approach I can not see report toolbar at client. I want that client to be able to navigate from page to page, choose option to export in XLS, PDF.Doc, to be able to print and to choose the printer like in desktop application.

second approach I have to test in the next days and I will let you know.

But I have one very logical question. Why it is working in developing with IIS Express and is not working in production server with IIS. For me this is unbelievable.

Thanks for reply

Of course I have tried with network monitoring and the same path in the IIS express is working fine, but In production environment IIS give 404 error.

IIS Express example:

<iframe width="99.5%" height="99%" id="myReport" src="….ReportsRaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&amp;idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&amp;Format=FACT&amp;lcnrZecimaleCantitate=3&amp;lcnrZecimalePret=2&amp;lcnrZecimaleValuta=2"
frameborder="1"></iframe>

URL Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache read‎‎ Gap‎‎
/Reports/RaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&Format=FACT&lcnrZecimaleCantitate=3&lcnrZecimalePret=2&lcnrZecimaleValuta=2 GET 200 text/html 58.79 KB 0.67 s frame
navigate 2465 0 655 16 0 1014

is working well

 

IIS production server example:

<iframe width="99.5%" height="99%" id="myReport" src="….ReportsRaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&amp;idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&amp;Format=FACT&amp;lcnrZecimaleCantitate=3&amp;lcnrZecimalePret=2&amp;lcnrZecimaleValuta=2"
frameborder="1"></iframe>

URL Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache read‎‎ Gap‎‎
/Reports/RaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&Format=FACT&lcnrZecimaleCantitate=3&lcnrZecimalePret=2&lcnrZecimaleValuta=2 GET 404 text/html 1.70 KB 125 ms frame
navigate 63 0 125 0 0 13634

 

If we are looking to the calling path in  both cases are the same. The entire structure of the folders were copied from development server to the production. No good results.

Any idea?

Thank you.

 

Tkank you for your reply. I will begin to study again this approach and compare with article which you recommended.

Thank you

[RESOLVED]Custom MVC route to support a legacy URL

I have an existing web site that has a folder structure to documents to be downloaded. 

I am replacing this site with a new MVC site.  

Custom routing seems to be the way to go to support legacy URLs and re-route to the new URL.

For example, there are a lot of hyperlinks in the wild that have been bookmarked by users, and sent out in emails.  I would like them to continue to work.

My old URL would look like this:

mywebsite.com/Documents/2014/February/nameofthefile.pdf

I want to write a custom route that would ignore the /2014/February part, then grab just the file name.

Would this work?

routes.MapRoute(
                "Documents",                                           // Route name
                "Documents/{Year}/{Month}/{FileName}",                            // URL with parameters
                new { controller = "Reports", action = "GetReportByFileName" }

Hi agent,

Thanks for your post.

agent_smith

I want to write a custom route that would ignore the /2014/February part, then grab just the file name.

If you want to ignore the the /2014/February part,you can add

Year=UrlParameter.Optional,Month=UrlParameter.Optional

More information:

Pease check these:

http://www.codeproject.com/Articles/641783/Customizing-Routes-in-ASP-NET-MVC

http://www.dotnetcurry.com/showarticle.aspx?ID=970

Hope this can be helpful.

Best Regards,

Eileen

[RESOLVED]How To Download file from server

Hi,

I have one link in my page when i click that link the file has to be downloaded from server or playstore.but i don’t know that code can any please tell me that and solve my problem.

any code is required for that or just path address of that file is enough.??

Thanks&Regards,

Praveen

praveen_527

just path address of that file is enough

In most scenarios just the address of the file is enough.

What is the file extension

Hi Prasanna ,

what ever it may be (exe,apk,png…etc).. it is also enough for that path..

in local it is woking ,when by global also it works or not..

Thanks.

Hi praveen,

To download the file, we could use FileResult as the return type.

For example:

public FileResult Download()
{
    byte[] fileBytes = System.IO.File.ReadAllBytes("c:foldermyfile.ext");
    string fileName = "myfile.ext";
    return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}

We also could base on file path to return the file.

Best Regards

Starain

Hi Starain,

Thanks for the reply.Right now I’m using HTML tag in my asp.net mvc project to download the file…i.e..

<a href="~/Content/Images/Main_Logo-01.png" download="Main logo">com.IceCreamSandwich.android.4.0-4.0.2</a>

 It works properly in my local system …is it works when i host  my project in server or not…???

Regards,

Praveen.

Hi friends,

I check that code in server it works good..and the issue is when i put the
.apk
file instead of that png or pdf .

it is not downloading the apk file from server and also from my project (visual studio).. can u guys please fix this issue..how to do this thing i dont’ve any idea about that..

Regards

Praveen

Hi Praveen,

You need to add a new MIME type with apk file name extension.

More information, please refer to:

# Add a MIME Type (IIS 7)

http://technet.microsoft.com/en-us/library/cc725608(v=ws.10).aspx

Best Regards

Starain

hi,

by adding the below line in webconfig file i got solve the problem ..

<system.webServer>
<staticContent>

<mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive" />

</staticContent>

</system.webServer>

Thank You guys for the support…

regards,

Praveen.

[RESOLVED]MVC Tutorials removed from website

Hello ! this week i got started with the Microsoft MVC. I was doing the movie store tutorial under the MVC4 tutorial pages and today when i was gonna continue the tutorial has been removed. All MVC tutorials are gone from the tutorials page of microsoft
MVC. Does anyone have a PDF or something with the tuts ? I woud like to complete the MvcMovie (MVC 4 tutorial),

Regards.

EDIT: I have found a PDF with the tutorial. (I dont know about posting links so if anybody needs it just google "mvc movie tutorial pdf" its the first link), shame on me, i should’ve searched the google before posting here.

Hi,

 My suggestion, use the following site:

http://www.asp.net/mvc/overview/getting-started/introduction/getting-started,

If you need to learn MVC, do not waste your time learn MVC4. Go direct to MVC 5. MVC 6 is coming next year, but MVC 5 still good to learn. Here a free video :

http://pluralsight.com/training/Player?author=scott-allen&name=aspdotnet-mvc5-fundamentals-m1-introduction&mode=live&clip=0&course=aspdotnet-mvc5-fundamentals

Have fun 

Hi,

Going forward, please post the link broken in feedback section of the forums.

http://forums.asp.net/188.aspx/1?Feedback+on+this+website

EDIT:

Notes from Terry:

We have consolidated the "Overview" and "Tutorials" areas into one "Guidance" area for MVC. There will be redirects to the new locations put up within the next day. You can see the old and new URLs here: http://forums.asp.net/t/2014539.aspx?ASP+NET+MVC+Content+Reorganization+10+23+2014

The content can be found under http://www.asp.net/mvc/overview. The tutorial you are looking for is now here: http://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on

I apologize for any inconvenience.

As the problem is now resolved, please look for any content in the latest urls.

Old and new links table announcement:

http://forums.asp.net/t/2014539.aspx?ASP+NET+MVC+Content+Reorganization+10+23+2014

Regards

Siva

[RESOLVED]MVC 3 – Entity framework – create database

Hi,

I finished this MVC 3 tutorial
http://www.asp.net/mvc/overview/older-versions/mvc-music-store/mvc-music-store-part-1
.

Than I deleted database file in App_Data folder.

In Global.asax.cs -> Application_Start I have

System.Data.Entity.Database.SetInitializer(new MyStore.Models.SampleData());

this is supposed to "prepare" a data for database and at the first query the database is created.

But when I run/debug, I get an error "An exception occurred while initializing the database. See the InnerException for details." in HomeController in method GetTopSellingAlbums().

HomeController code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MyStore.Models;

namespace MyStore.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/
        StoreEntities storeDB = new StoreEntities();
        public ActionResult Index()
        {

            //System.Data.Entity.Database.SetInitializer(new MyStore.Models.SampleData());
            
            // Get most popular albums
            var albums = GetTopSellingAlbums(14);

            return View(albums);
        }
        private List<Album> GetTopSellingAlbums(int count)
        {
            // Group the order details by album and return
            // the albums with the highest count
            return storeDB.Albums
                .Take(count)
                .ToList();
        }
    }
}

SampleData.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace MyStore.Models
{
    public class SampleData : CreateDatabaseIfNotExists<StoreEntities>
    {
        protected override void Seed(StoreEntities context)
        {
.
.
.
}
}
}

Why the database isn’t created?

Perinho

Why the database isn’t created?

Music store uses code first approach. Hence it should create the database. I suspect you may be missing something, like connection string etc. I suggest download the pdf document from the below link and follow the chapter 4

https://mvcmusicstore.codeplex.com/

All I did was delete database file in Solution Explorer. Connection strings are untouched.

Web.config :

<connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)v11.0;Initial Catalog=aspnet-MyStore-20141022120832;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnet-MyStore-20141022120832.mdf" />
    <add name="MyStoreEntities" connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf" providerName="System.Data.SqlServerCe.4.0"/> 
  </connectionStrings>

How can I force the database to be created before GetTopSellingAlbums() is called in HomeController?

And why is HomeController run before Application_Start() in Global.asax.cs?

your connection string says you have a mdf file that should be attached to sqlserver, then set the default database to the one in the mdf. if you deleted your mfd file (rather then delete tables in database), then you will need to create a new database (name
should match connection string catalog name) with sqlserver,  detach it and copy the new mfd to the desired location.

you can change your project to create database rather than attach. in this case edit the data connection used.

I created MyStore.Models.StoreEntities.mdf in App_Data folder and now it’s working.

Thank you.

[RESOLVED]Charts control api in MVC C#

Hi All,

My requirement to display data using charts control. Is it possible to display the data in charts control (All type of charts eg, Combination of line and bar charts, line charts, bar charts) using MVC razor view. My organization don’t want to use any third
party(Paid api) for visualization.

Please suggest me the the right api(free version) that could help me show all kind of charts in mvc

Thanks in advance

You can use the Microsoft charting library. I blogged about it some time ago: http://www.mikesdotnetting.com/Article/115/Microsoft-Chart-Controls-to-PDF-with-iTextSharp-and-ASP.NET-MVC

There are some samples available here: http://code.msdn.microsoft.com/Samples-Environments-for-b01e9c61

Mikesdotnetting

You can use the Microsoft charting library. I blogged about it some time ago: http://www.mikesdotnetting.com/Article/115/Microsoft-Chart-Controls-to-PDF-with-iTextSharp-and-ASP.NET-MVC

There are some samples available here: http://code.msdn.microsoft.com/Samples-Environments-for-b01e9c61

Thanks Mikesdotnetting for shared this useful link. I want one clarification: Can we create combination of charts(Line and Bar) in single charts using Microsoft charting library?

I don’t know. You can check the link I provided for samples.

Hi info2ambrish,

As far as I know, there isn’t the combination chart in Microsoft chart library.

For combination chart, you could refer to this article:

# Combination Chart

http://mvc.syncfusion.com/demos/ui/chart/ChartType/CombinationChart

Best Regards

Starain Chen

Starain chen – MSFT

For combination chart, you could refer to this article:

# Combination Chart

http://mvc.syncfusion.com/demos/ui/chart/ChartType/CombinationChart

That’s a paid for component.

I saw a "guy-at-work" create, from scratch a charting server in about 4 days just last week.  He used HighCharts and had no experience with charting before
this. 

I used MSFT’s charting components for years and found it to be quite complex ,but that’s just my opinion.

i checked out high charts its simply superb, it is much like google charts, except that google dont allow you to download javascript library and the client needs to have internet connection inside corporate VPNS to work.

Hi Ambrish,

We have used JQPlots  http://www.jqplot.com/ in our application , its A Versatile and Expandable jQuery Plotting Plugin

its easy to use. you can refer this link. - http://www.jqplot.com/tests/

 

Thanks for reply.

I gone through the shared link and It was very useful  but In my organization don’t want to buy any third party library for combination chart. They are forcing me to do the combination chart using Microsoft charts control only. Please let me know any free
library, that I can use in my project to get the combination charts.

Thanks in advance

Hi info2ambrish,

Since there isn’t that feature in the Microsoft chart control, I suggest that you could submit the feature request to here:
http://aspnet.uservoice.com/forums/41199-general-asp-net, after you submit it, please post the link here which will benefit to others who has the similar issue.

On the other hand, I don’t find any free library to support combination chart.

Best Regards

Starain Chen

Hi Starain Chen,

Is it possible to create combination charts using jQuery or JavaScript or Ajax Chart Control?

Kindly let me know any alternate way to solve my issue……..I don’t know What I should do at this point of time…..They just forcing me do and they are saying it is possible to do using MS charts control but they are not providing any code snip
for this. Upper management saying we have done it long time back, Search it and do it ASAP.

Thanks in advance

Hi info2ambrish,

Base on my test, I found that we can achieve combination charts by using MS charts!

We just need add multiple series to the chart.

This is the sample code:

 

@{
    ViewBag.Title = "Index";

    var myChart = new Chart(width: 600, height: 400)
        .AddTitle("test")
        .AddSeries(
        name: "Username: Davolio",
        xValue: new[] { "One", "Two", "Three", "Four", "File", "Six" },
        yValues: new[] { "2", "6", "4", "5", "3", "8" });

    myChart.AddSeries(
        name: "new series",
        chartType: "Spline",
        xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave","Star" },
         yValues: new[] { "2", "6", "4", "5", "3","10" });
    myChart.Write();
}

Best Regards

Starain Chen

Starain chen – MSFT

Hi info2ambrish,

Base on my test, I found that we can achieve combination charts by using MS charts!

We just need add multiple series to the chart.

This is the sample code:

 

@{
    ViewBag.Title = "Index";

    var myChart = new Chart(width: 600, height: 400)
        .AddTitle("test")
        .AddSeries(
        name: "Username: Davolio",
        xValue: new[] { "One", "Two", "Three", "Four", "File", "Six" },
        yValues: new[] { "2", "6", "4", "5", "3", "8" });

    myChart.AddSeries(
        name: "new series",
        chartType: "Spline",
        xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave","Star" },
         yValues: new[] { "2", "6", "4", "5", "3","10" });
    myChart.Write();
}

Best Regards

Starain Chen

Thanks a lot for this post. This is really helped me lot.

[RESOLVED]Simple MVC grid that is populated with data, How to extract it as a pdf

I have this simple MVC grid with data populated from a search result and what I would like next to the Delete link is a pdf Icon and once I click on it it does a export in pdf as a nice format on what is displayed on the data grid

Can anyone give me some tip on how to do this?

Best Approach to convert a asp.net webpage details to PDF document

Hi All,
I have a requirement and would require expert opinion and help.
I have a asp.net web application form, where users enter details and hit on save a pdf with the details entered has to be emailed to the user in the same format.
Can you please let me the best approach for doing the same.

Can you please let me know any sample code if available with you.

Is there an option to do the same without using third party dlls and use any class which Microsoft has provided.

Thanks for the help on advance.

jatscorpio

Is there an option to do the same without using third party dlls and use any class which Microsoft has provided.

No.