Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
JQGrid and ASPNet MVC
29/08/2008
10:06
Avatar
nsorochan
Member
Members
Forum Posts: 17
Member Since:
29/08/2008
sp_UserOfflineSmall Offline

I am having issues using JQGrid and MVC framework.  IF I have an application with no application name everything works fine.  For example, if my url is http://localhost/Home/Example, everything is fine.

However, if my application has an application name http://localhost/myapp/Home/Example the url does not work.  It does not take into accout the application name.

I have tried many variations of the url, /Home/Example, /../Home/Example, ~/Home/Example.  It does not see the application name.  Are my routes incorrect?  I am just using the default route when you created an MVC application.

29/08/2008
11:14
Avatar
son122
Member
Members
Forum Posts: 32
Member Since:
07/07/2008
sp_UserOfflineSmall Offline

I used the grid for ASP.NET MVC too.  No longer though.

I'm currently using castle monorail which is similar to that framework.

IIRC, you need to change your routing rules from the default to take that

into account.

29/08/2008
11:43
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Also if possible check the paths to js files. You need to ajust this

in the loader.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

18/09/2008
07:28
Avatar
Renso
PA
Member
Members
Forum Posts: 118
Member Since:
11/09/2008
sp_UserOfflineSmall Offline

Good question. Mvc will support any path you thorw at it as long as it's pattern is mapped in the route dictionary. For example in my case I have such a big Mvc app I decided to create sub-folders for my controllers. Remember, the Mvc routingengine abstracts the folder structure you have so you don't have to reveal your folder structure in your url. I have an Account folder with an AccountController, AccountSummaryController, etc. So my url would look like /Account/Account/GetMyDataById/101, but it doesn't, it only shows /Account/GetMyDataById/101.

If you do not specifcy the "/" in front of the Account in your url in your ajax call, the routing engine will prefix your url with the current url, so you will get something like /Account/GetMyDataById/Account/GetMyDataById/101. So make sure you prefix url with an "/" and include the controller: "/Account/GetMyDataById".

Just as an example my route map looks like this:

routes.MapRoute("Account", "Account/{action}/{accountId}",
                            new { controller = "Account", action = "Index", accountId = (string)null });

My editurl looks like this (includes account id, rows and page:

            editurl:'/Account/SaveOrUpdateAccount?accountId='+$('fieldset#AccountDetails #Id').val()+'&rows='+$rows+'&page=1',

18/09/2008
20:39
Avatar
thatisscary
Member
Members
Forum Posts: 6
Member Since:
06/06/2008
sp_UserOfflineSmall Offline

Actually, this is a known issue with Asp.net MVC, when you are using

a virtual directory. 

However, using the Url.Action to generate the URL for the grid is sufficient.

It will append the application to the path, save this off into a string and

then apply the string to the url property of the grid.

<%

string path = Url.Action("ActionName", "Controller");

%>

<script>

var jqGridUrl = '<%=path%>'

url:jqGridUrl

The rendering engine gets upset when you try to evalue scripts in the jquery section, so just define it somewhere else and then use it.

Matthew

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
56 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information