Latest posts on "asp-net-MVC"

[solved]The model item passed into the dictionary is of type 'System.Data.Entity.Infrastructure.DbQuery`1[<> f__AnonymousType2`2[System.String,System.String]]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1'

7 June 2016

When I was trying to run the application I had faced this problem. I resolved by selecting the complete object that result will consists of complete customer objects. But before I selected a subset of the customer objects, just two members.

Controller to a view Integer array in asp.net mvc

6 June 2016

In this example I will show you how to pass integer array from controller to a view. I stored list of numbers in an integer array and index function will return that in a view.

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.