asp.net-mvc

How to implement search on jqgrid?

So I've got basic example of jqgrid working in ASP.NET MVC, the javascript looks like this: $(document).ready(function() { $("#list").jqGrid({ url: '../../Home/Example', datatype: 'json', myType: 'GET', colNames: ['Id', 'Action', 'Parameters'], colModel: [ ...

handling CSS & Images in ASP.NET MVC

Hi I am developing a simple application based upon ASP.NET MVC. I have altered the default master.css to my have my own styles. Now the only problem is that i am adding background-image property to my one of my UL->Li->A to create menus. It is working fine in firefox but the images are not showing up at all in Internet explorer (IE7/8). ...

ASP.NET MVC application controller constructor problem

I've created an application controller abstract class that my controllers derive from (As described in the following article) The following is an example of what my code looks like public abstract class ApplicationController : Controller { private ProjectDataContext datacontext = new ProjectDataContext(); protected ProjectData...

ASP.NET Web Architecture Design - Part 2

I've actually asked about this already in this post although we've gone back to the drawing board and found it's much more difficult than we initially thought. We develop a large (and very much relied upon) Intranet system which has evolved tremendously over the years. The problem is that it uses frames to have a menu on the left, a he...

When debugging an ASP.NET MVC app, how can I get my changes to Site.css to show up?

I'm debugging on my development machine and when I make changes to the css file, they don't show up and I can't figure out why. I'm using firebug and inspecting the css and the changes are not there. I've tried clear private data and building the project first then running it but nothing seems to work. Thanks. ...

ASP.NET MVC - Complex Objects and Forms

So let's say we have a domain object such as the following public class Person { public string Name { get; set; } public IList<PhoneNumber> PhoneNumbers {get; set; } public IList<Address> Addresses { get; set; } } The Person is not valid until a name, phone numbers, and addresses have been entered. How do you guys handle this...

Passing information to usercontrol in ASP.NET MVC

hi everyone, I know how pass viewdata into a user control which is like this <% Html.RenderPartial("someUserControl.ascx", viewData); %> This is what i want to do: In the current situation i have events calendar and each section of my events calendar is a wired to a user control, so ideally when i pass a date value to my user contr...

401 Returned for every 5th call in an ASP.NET MVC application that returns JSON

This is nuts. I have an ASP.NET MVC application using Windows authentication that, amongst other things, interacts with a number of ExtJs Javascript components by returning JSON data to them. The problem is that even after the user is successfully authenticated, every 5th request to grab some JSON data from MVC results in TWO "401 Unau...

IronPython on ASP.NET MVC

Has anyone tried ASP.NET MVC using IronPython? Having done a lot of Python development recently, it would be nice to continue with the language as I go into a potential ASP.NET MVC project. I'm especially interested in exploiting the dynamic aspects of Python with .NET features such as LINQ and want to know if this will be possible. T...

Getting Trace messages into Failed Request Tracing from Controllers

On ASP.NET MVC Preview 5, we're having trouble getting any trace messages from Global or Controllers to appear in either a page (View) or Failed Request Tracing (FREB). Neither of these calls work in a Controller Action: HttpContext.Trace.Write("hello"); System.Diagnostics.Trace.WriteLine("world"); There are no issues with trace stat...

How do you handle multiple submit buttons in ASP.NET MVC Framework?

Is there some easy way to handle multiple submit buttons from the same form? Example: <% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %> <input type="submit" value="Send" /> <input type="submit" value="Cancel" /> <% Html.EndForm(); %> Any idea how to do this in ASP.NET Framework Beta? All examples I've googled for have...

How much logic is allowed in ASP.NET MVC views?

In looking at samples of ASP.NET MVC sites, I'm seeing quite a bit of examples with embedded logic in the views, e.g.: <% if (customerIsAllowed) { %> <p>nnn</p> <p>nnn</p> <p>nnn</p> <p>nnn</p> <p>nnn</p> <% } else {%> <p>nnn</p> <p>nnn</p> <p>nnn</p> <p>nnn</p> <p>nnn</p> <% } %> Although this se...

How to host an asp.net mvc app on a domain that points to a subfolder?

I have the folowing scenario: www.somedomain.com -> this points to a folder on a shared host, say /MyFolder1 www.otherdomain.com -> this points to another folder on the same shared host, say /MyFolder2 With asp.net mvc my urls get mapped to: www.somedomain.com/MyFolder1/Action www.somedomain.com/MyFolder2/Action I (obviosly) dont't w...

Can't Attach ASPNETDB.MDF on Vista

I can't connect to the ASPNETDB.MDF file in the App_Data that is created by the ASP.NET MVC Beta project from Visual Studio 2008 or SQL Management Studio 2008 Express on Vista. The project is in C:\Users\Matthew\Documents\Visual Studio 2008\Projects\MVCTest so the MDF file is in C:\Users\Matthew\Documents\Visual Studio 2008\Projects\MVCT...

MVC: Repositories and Services

I am confused as to the limitations of what gets defined in the Repositories and what to leave to the Services. Should the repository only create simple entities matching tables from the database or can it create complex custom object with combinations of those entities? in other words: Should Services be making various Linq to SQL que...

NHibernate IQuery.List Error "Invalid index 4 for this SqlParameterCollection with Count=4."

Long title, I know but I searched all over and couldn't find that error message coming from that function call so I thought this might be more useful. This is the code snippet: string hql = " from LabRequest r where 1 = 1 "; hql += " and 0 < (select count(rs) "; hql += " from r.Statuses rs "; hql += " where rs.Stat...

Prevent asp.net mvc from generating URLs with subfolders

I have my site hosted on a subfolder (ApplicationPath). I have ISAPI Rewrite to translate from www.domain.com/Subfolder to www.domain.com. The problem is that asp.net MVC Html.ActionLink() (and similar functions) generates URLS with www.domain.com/Subfolder. I want to be able to remove the "/Subfolder" from the URL as the ISAPI Rewrite w...

How can I cache objects in ASP.NET MVC?

For instance I have a BaseController that I want all Controllers to inherit from. Within there I want to have a User property that will simply grab the User data from the database so that I can use it within the controller, pass it to the views, stuff like that. Code would look something like: protected User GetUser(int id) { return...

Preventing XSS (Cross-site Scripting)

Let's say I have a simple ASP.NET MVC blog application and I want to allow readers to add comments to a blog post. If I want to prevent any type of XSS shenanigans, I could HTML encode all comments so that they become harmless when rendered. However, what if I wanted to some basic functionality like hyperlinks, bolding, italics, etc? ...

Trying to return asp.net mvc JSONResult with VB.Net

Hi Everyone, I'm trying to return a record from LINQ2SQL as a JsonResult to update my view page via jquery ajax. I'll post my code below. When I follow it through the debugger my function in the controller is being called and it is returning a record. I think there might be something wrong with my Jquery to retrieve the JSONResult. ...