Most common problems and solutions

JSON is undefined

on IE8 and lower; seen in browser console; solution: you need to reference JSON2.js https://github.com/douglascrockford/JSON-js/blob/master/json2.js

A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies....'

Happens when json serializing the GridModelBuilder<Model>.Build result (gridmodel) and the grid Model has a circular reference in the object hierarchy, you solve this problem by setting the Map property, example:
 new GridModelBuilder<MyCircularModel>(list, g)
            {
                Map = o => new
                {
                    o.Prop1, // and specify here only the properties that you need to display
                    o.Prop2,
                }
            }.Build()

Clicking PopupForm Ok button does nothing

if there's no js errors (look in the browser console) and nothing happens it's most likely the client side validation preventing the form submit, but you can't see the validation error because you don't have an Html.ValidationMessage for that field

It (Grid/AjaxDropdown/etc.) doesn't work/load

If something doesn't work first try to find the problem, the problem could be a server problem ( wrong connection string, etc.) or client side (js error, jquery not referenced, multiple html tags with same ids etc.). Server side problems can be identified by running the webapp from Visual Studio (with default settings) in debug mode (by hitting F5), you can add some breakpoints. Client side errors can be seen using web debugging tools, in Chrome hit F12 -> "Console", in the console you'll see all the javascript and ajax errors, for ajax errors 500 is server error so you have to investigate on the server side, 404 means the endpoint doesn't exist you're probably setting a wrong url (you can try this right now, go to : http://demo.aspnetawesome.com/ErrorHandlingDemo do F12 -> Console and after click on the "Open Popup" link, you should see an error 500, that's because at the server side we have a throw Exception in the action called). Also, make sure you have unique html ids/helper names, for example if you have something like this:
@Html.Awe().Lookup("Foo") @Html.Awe().Lookup("Foo") // you'll have 2 lookups both with html id = "Foo", this will cause problems
or even if you have on the page and another one with same id being loaded via ajax e.g. in a popupform it will also cause problems you can use the .Prefix extension to add a prefix to the html id or just use a different name

Popup problems

Make sure the Url that returns content to the popup is not returning the masterpage as well (_Layout.cshtml), because this will load all the js scripts again which may cause problems. So, if you are setting:
 Layout = "~/Views/Shared/_Layout.cshtml"; 
in _ViewStart.cshtml, this means that all the views will have the same Layout, and you can either return PartialView() in your action or set Layout = null in the view

Getting trial message after purchasing and using the downloaded binaries

You need to replace all the files
dll/js/css
, your browser could cache the
js/css
files, most times refresh is enough, clearing the cache could be necessary, or you could modify the script urls by adding a version e.g.
AwesomeMvc.js?v=2
. The dll can sometimes be cached by Visual Studio, so you may need to restart VS, and/or clear all the bin folders. To make sure you're using the non trial dlls go to the
YourWebApp/bin
folder and find the
Omu.AwesomeMvc.dll
file right click
->
Properties
->
Details Tab, check
Product Name
it shouldn't have the word "trial" in it, you can also use
Html.Awe().About()
helper which renders the version used.

Isolate the problem

Usually when you ask a question on our forums (or codeplex, stackoverflow) and it's hard for us to understand the problem, we will ask you to create a mini project that will isolate the problem. Often times people find the solution while they are doing this mini project. The project should use the trial version of ASP.net MVC Awesome and should not use any Database, use sample objects instead (you can use the Db class that is used for tutorials), after you zip it, upload it somewhere and post the link so we could have a look at it. We recommend that you make this mini project by downloading and editing the Min setup demo for ASP.net Core or Min setup demo for MVC5

Problems when upgrading to a newer version

Make sure replace all the files dll/js/css, clear the browser cache, or modify the script urls by adding a version e.g. AwesomeMvc.js?v=2. The dll can sometimes be cached by Visual Studio, so you may need to restart VS, and/or clear all the bin folders. For each new version in the release notes we have instructions on how to migrate your version from the previous one, here's an example for version 6: https://www.aspnetawesome.com/learn/release/Version6#Migrating-from-previous-versions . You need to go through all the release notes starting with the first release after your older version.

Form field does not get the label and validation message

In our asp.net demos we use Editor helpers (
EditorFor(o => o.Property)
) to create Create/Edit views. An editor helper will render a view from
Shared/EditorTemplates/
folder based on the type of the
Property
it is rendering or the view name specified in the
UIHint
attribute e.g.
[UIHint("TextArea")]
, in this case it will render
Shared/EditorTemplate/TextArea.cshtml
, if
UIHint
is not specified and the Property is of type string it will look for
String.cshtml
. All the editor templates views in our demo use a Layout view called
_FieldLayout.cshtml
, in this view you can find the call to render the label and the
ValidationMessageFor
helper. So if your field doesn't get the label and the validation message this means that Viewmodel Property type or UIHint value point the Editor helper to an EditorTemplate view that is not using the
_FieldLayout.cshtml
.



Comments