Issue with Grid control - not "re-initializing" after attempting add or edit...?

Jul 31, 2012 at 11:20 PM

I have been working on implementing the Grid control in an MVC4 application I am working on. After overcoming a number of issues, I thought I had it made, but now I am experiencing an issue I can't figure out.

I have implemented my control exactly as demonstrated in the BasicTutorialsCode, Mvc3 example. When I click on the "edit" icon to edit one of the rows, I see the editor template display and the fields become editable. If I dismiss the editor with the "undo" icon, and then click the "Edit" icon again, nothing happens.

I am getting the same behavior with the "Add/insert" functionality : if I click on the icon once, I can add a record. But if I dismiss the icon with the "undo" option, then click the "Add" icon again, nothing happens. I have been trying to step through in Firebug, Chrome and other tools but can't seem to figure it out. Any advice is greatly appreciated.

And thanks for providing this toolkit to the masses - it's great!

Kevin

Coordinator
Aug 1, 2012 at 10:37 AM

As a first step verify that:

1) You have installed then Mvc4ControlsToolkit dll and not the Mvc3ControlsToolkit one in your project. However probably this is not the cuase of the issue.

2) It looks like the cause of the issue is javascript error that takes place for some reason...Considering you are using Mvc4 ...be susre you have not inclueded some javascript file twice because of the bundling feature, and that the order of the files is the same as the one of the example you referred to.

3) Other likely causes of errors are you have a jquery validation plugin that is not compatible with the version of jquery you are using (easily solved by using the last versions). Finally if your culture is not the english culture...don't forget to include the globalization files specific for the cultures you need. They are not INSTALLED AUTOMATICALLY BY the nuget package since they are too many files...and this slow down too much the installation of the package. So you have do copy the one you need.

4) Finally, some javascript error caused by some control  you put in the edit template

Aug 1, 2012 at 3:08 PM

Frank - 

Thanks so much for the tips. I am going to go through each of your suggestions and be sure that I have implemented everything as you mentioned. I will post an update afterwards. Thanks again!

Aug 1, 2012 at 6:09 PM

Ok, I verified that all of things you mentioned were implemented correctly, still seeing same problem. To duplicate issue, here are the steps I took :

1. Browse to page with the grid control.

2 . Click on the "Edit" icon next to the second item in the list; at this point, the item goes into edit mode as expected, showing editable textboxes for all the fields.

3. Without changing any of the values or clicking into any of the textbox fields, dismiss the editing template by clicking the "Undo" button.

4. Click on the same "Edit" button for the same row (2nd item) clicked on in step 2.

5. At this point, nothing  happens - I click on the "Edit" button for the second item, nothing happens, and I don't see any javascript errors in Firebug or Chrome developer tools.

6. If however, I click on another rows "Edit" button, I can edit it - BUT, if I dismiss, then click the Edit button again, same thing happens.

 

I have verified that all of the scripts are loading correctly and there are no javascript errors showing. For whatever reason, it seems like after clicking Edit and dismissing, that Edit button/link dies, and becomes inactive. Any help or advice is greatly appreciated.

 

- Kevin

Coordinator
Aug 2, 2012 at 9:49 AM

I am confused.....

You mean that the problem exists also in the original examples downloaded from codeplex? 

This is strange because I tested them and they work...however they are Mvc 3 examples not Mvc 4 examples....Which example are you referring to...tha basic tutorial folder contains 4 examples: one for Mvc 2, another for Mvc 3 with the aspx View engine, one for Mvc 3 For the Razor engine and finally one with Mvc 3 Razor and advanced filtering techniques.

If everything above fail...an explanation, pls send a solution showing the problem to me using the contact form of my blog: http://www.dotnet-programming.com/

or explain me how you turned this examples into Mvc 4 example....I think something bad happened in this process....Again it is quite strange since the pronlem should be a javascript problem not a problem with binaries

Coordinator
Aug 2, 2012 at 10:51 AM
Edited Aug 2, 2012 at 10:54 AM

If your are using a recent version of the validation jquery plugin you shoauld add:

 

$.validator.setDefaults({
    ignore: "not([data-elementispart]):hidden"
});

 

since as default the new version of the validation library validates just visible fields...and this create problems with complex widjets that may use hidden fileds to store information.....However again I dont think this might cause your error.

See here form ore details: http://mvccontrolstoolkit.codeplex.com/wikipage?title=Validation%20Setting