Latest posts on "asp-net-MVC"

Passing string to view mvc

5 June 2016

In this example I will show you how to pass string to view mvc in application. The appropriate way to you must cast in to an object and return as view. In view model you must define the object type and write the string in required place.

Passing IEnumerable string to view mvc

5 June 2016

In this example I will show you how to pass IEnumerable string to view mvc in application. I used string array with array elements contains list of names. I filtered names having length >=5 and assigned to IEnumerable string varable. The appropriate way to pass data from controller to view, is to pass the filterednames to the view

A potentially dangerous Request.Form value was detected from the client.

26 May 2016

I have created a table “article” with columns articleId and article_content. I am also using html editor for “article_content” column. When I am trying to save I got the following error. It was resolved by adding [AllowHtml] to Description property in class.

How to read text file using fileupload control in asp.net MVC?

25 May 2016

In this step by step article describes how to read text file using fileupload control in asp.net MVC.create a post form method with html controls file, button and create a folder name with Document in the project. When user choose the text file and click the submit button the controller will receive file type, name etc. we will save the file in our project document folder.

[Solved] The relationship model was not loaded because the type model is not available.The following information may be useful in resolving the previous error: The required property does not exist on the type model class

25 May 2016

When I created new table “post” and give foreign key relation to another “category” table after that run the custom tool by right click on edmx file. While running the application I got the following error. It was cleared by including post table foreign key relation to the category class.

How to share image to twitter post using asp.net MVC?

23 May 2016

In this article we will describe how to share a post along with image in twitter. We can share image with SendTweetWithMedia() method by passing image as stream. Inorder to send image as stream we need to convert it.

How to share twitter post using asp.net MVC c#?

23 May 2016

The sample code in this article demonstrates share twitter post programmatically. To create a twitter application using Twitter apps and get a customer key (API Key) and customer secret (API key). Inorder to share twitter post we need to Install-Package TweetSharp using nuget package manager console and reference to the page.

How to pass multiple parameters to a POST method using jQuery Ajax in asp.net MVC?

22 May 2016

In this article we will discuss to pass multiple parameters from Ajax post call in asp.net MVC application. Before I have faced issues with jQuery ajax post call to a controller with multiple parameter due to syntax errors. Now I have found a way by passing JSON stringifyed Object to a [HttpPost] method.

[Solved] CS1003: Syntax error, '>' expected

21 May 2016

When I run the application I got error “CS1003: Syntax error, '>' expected”. After that I realized the mistake because of semicolon (;) I put after the model class in the Index.cshtml view “@model MVC_tutorials.Models.Document;”

How to create word document file using asp.net MVC?

21 May 2016

In this step-by-step article descrbes how to create a MS word document file using asp.net. The sample code in this article demonstrates how to insert paragraphs with text programmatically.