Posts

Showing posts from August, 2014

EnableEventValidation="False" and Strange javascript Errors.

We have been moving some stuff from an older DNN 5 professional installation to a newer  DNN 7 Community edition. A module when moved over kept having these unusual errors, and I was given it to figure out the issue.  The datagrid in it stopped being able to sort, or some columns would only sort once.  Other problems were that the OnClick event would only go to the OnLoad page event, instead of going to the datagrid row command event.  There was aPage Setting in the older DNN5 site that once added to the newer Default.aspx page fixed all the errors. That setting is "EnableEventValidation = "False" ".

Layout Page Rendering Multiple Times

Image
We noticed a copyright notice appearing multiple times on the bottom of the page with the jqgrid.  Well, that a rather interesting issue.  The main layout was being called multiple times.   To prevent the main page, the Layout from being called multiple times, it was necessary to return PartialView instead of View.  I guess the rendering of a View, will always try to render the Layout.  Need to investigate more the differences between a PartialView and a View. http://stackoverflow.com/questions/19272720/error-executing-child-request-for-handler-in-view

Resource cannot be found: MVC startup error

Image
Make sure to remove any sort of specific page in property settings for the project.  Also make sure that if you have a page it actually is the correct link for it.

MVC with JQGrid - Having a Link with Multiple Parameters

The Issue with this is that there was not an easy way for me to access other data in the model to create a link with mulitple parameters.  In the Jqgrid there are two main ways of creating a link. 1. Predefined Formatter  { name: "Detail", index: "Detail", formatter: 'showlink',       formatoptions: { baseLinkUrl: '/GridDetail/Detail' }} 2. Custom Formatter { name: "Detail", index: "Detail", formatter: getDetailLink } then you would have   function getDetailLink(cellvalue, options, rowObject) {  var link = '<a href="/CC/GridDetail' + '/' + rowObject[2] + '">Detail</a>'; return link; } The 1st option has very limited parameter support, namely just the id. The 2nd method based on the documentation and answers in jqgrid and stackoverflow forums, you SHOULD be able to access the rowObject with rowObject.propName.  However I cannot use that for some reason that I cannot deter

JqGrid Error: Asc is not a column

As linked here :http://trirand.net/forum/default.aspx?g=posts&t=909, there is an issue with sorting with grouping.  Say in your controller you have something similar to this:   public ActionResult _JqGridGetData(string sidx = "", string sord = "", int page = 1, int rows = 0) {    //https://github.com/kahanu/System.Linq.Dynamic             if (!String.IsNullOrWhiteSpace(sidx))             {                 res = res.OrderBy(String.Format("{0} {1}", sidx, sord)).AsQueryable();             } ... } you may encounter an error where sidx is of the form "[col] [sort]," and then sord is "[sord]", and it may look something like "rID asc, asc". The resolution that I found is that when you are grouping and failed to specify the sortname and sortorder properies for the jqgrid this error will occur.  Once you specify the properties like below the problem should disappear.  jQuery(document).ready(function () {        

Be careful with syntax in View in MVC

We kept getting odd errors in a page, and it was due to a rogue comma in the view.  What made it worse was that there was no error or anything during compiling, only during run time.  Also the inner exception detail was not giving us any detailed info either.  In the future I need to do a check syntax check on the View code if I get odd errors that should not be occurring.

Could not see or use classes in Class in AppCode in MVC 5

You need to check that Property of the class in the App Code is set to "Compile" not "Content".  It also needs to be the same language as the language for the project. http://stackoverflow.com/questions/10620947/asp-net-mvc-3-and-app-code-folder

An item with the same key has already been added (MVC same property name error)

http://stackoverflow.com/questions/5648060/an-item-with-the-same-key-has-already-been-added A fellow developer kept having this odd key error in an MVC application.  Turned out they were inheriting from a class that contained a property with the same name in both classes.  When trying to post to an ActionResult only then would it throw that "same key exists" run time error.  Changing the property name fixed the issue.