asp.net-mvc

Linq to SQL using Repository Pattern: Object has no supported translation to SQL

I have been scratching my head all morning behind this but still haven't been able to figure out what might be causing this. I have a composite repository object that references two other repositories. I'm trying to instantiate a Model type in my LINQ query (see first code snippet). public class SqlCommunityRepository : ICommunityRepo...

MVCContrib Grid showing headers when empty?

The elegant Action Syntax in the MVCContrib Grid gives us the Empty() method. However, the default behavior of MvcContrib.UI.Grid.GridRenderer<T>.RenderHeader() is to hide the table column headers when the grid is empty. Is there a way to show headers when data is not present that does not require a major refactoring? Now I have heard o...

whats the best way to pass a full date time into a URL in asp.net mvc

i have a full datetime object that i need to pass in as a parameter in a URL. what is the best way to do this so it fully can get converted to a csharp DateTime object and not lose any precision ? ...

The ViewData item that has the key 'MY KEY' is of type 'System.String' but must be of type 'IEnumerable<SelectListItem>'.

I am trying to populate a dropdown list from a database mapped with Linq 2 SQL, using ASP.NET MVC 2, and keep getting this error. I am so confused because I am declaring a variable with the type IEnumerable<SelectListItem> on the second line, but the error makes me think this is not the case. I feel like this should be very simple, but ...

ASP.NET MVC gotchas and lessons learned

Tomorrow I will kick off a new project, a line of business application for a client and I have decided to build with asp.net mvc. I am an experienced webforms developer, also silverlight lately but this will be my first real mvc app. I have watched some videos and get the core concepts enough that I have tossed together some proof of con...

Using RenderPartial twice for same mvc view control in one page, get problems.

I'm using same partial view in create.aspx view page twice, part of my code is: <%Html.RenderPartial("LocationVerifyControl"); %> <%Html.RenderPartial("LocationVerifyControl"); %> In the mvc view user controls, it had a button and test code for it: $('#btnVerify').click(function() { alert("clicked by btnVerify");} I watched...

How to retain value from a text box on button click from a view, asp.net mvc

I have two views 1 . Add.aspx 2. Change.aspx View Add has a TextBox named menu, where i can type data. I have a 'Add' button below the textbox which redirects to the next view 'Change' 'Change' view has a button named 'Cancel' which on click redirects back to the add page. My Question is, How can I persist data entered in the 'Menu' ...

Deploy mvc.net on none root IIS app folder

Hi, The title may be a little unclear, but I didn't know how to describe it otherwise. The problem is the following: I have an mvc website and 2 servers, a testing server and the real server. the problem is: the testing server folder is a root folder, so the adress is: http://www.testingserver.com/ -> this poses no problem. but now ...

should I install asp.net mvc 2 on a deploy machine ?

I'm deploying an asp.net mvc 2 app on windows 2008 R2 and I get error that there is no system.web.mvc.dll, Should I install mvc2 on the deploy machine ? ...

Error in ASP.NET MVC SelectList. Value Cannot be null, parameter name: items

This line is causing me some problems in an MVC app i'm developing <%= Html.DropDownListFor(model => model.TypeID, new SelectList((IEnumerable)ViewData["TaskingTypes"], "TypeID", "TypeName"))%> It causes the error in the title when two other required fields in the form are not filled in. When the fields are filled in, the form is sub...

Watertight exception handling with Elmah in an MVC application.

I am trying in design a watertight exception handling strategy for an MVC application in which we use Elmah for logging unhandled exceptions. I would like some critique on some of my thoughts. All application exceptions should be handled in the controller layer. Any unhandled exception below that layer should be the result of a reque...

Tree View In MVC

Hai All How can i add a tree view in MVC. ...

How can I implement a label file for regions that integrates well with MVC application structure?

Background: I am working on a site that will be available in multiple regions. Each region can have a different language, or different spellings for the same language. We are planning on using an XML label file which will contain all the text that will be displayed for any given region. So regionA will load RegionALabels.xml and all o...

How asp.net MVC's cache and Firefox's cache work ?

I use the following code to write cache header on *.png requests: response.Buffer = false; response.BufferOutput = false; // Emit content type and encoding based on the file extension and // whether the response is compressed response.ContentType = MimeMapping.GetMimeMapping(physicalFileP...

Is the MVC Controller Layer the ideal place for error handling?

It would seem so to me, because nearly all exceptions thrown downstream of whatever routes requests to controllers, will be thrown in a controller or something downstream from a controller. There is nothing upstream from a controller except a view, which is simply a presentation of what happened in the controller. ...

HTML Form Tag isn't being generated when page is rendered in Firefox

Hi everyone, My English is very bad, please forgive. I developed a basic web page in MVC 2 for learning the framework, and I am stuck in this situation: I have 3 classes: Client - Product - New. And for all need to display a modal popup to create/edit action. For display the modal i used JQuery and jqModal plug-in. I created the con...

ASP.NET MVC 2 Create Model using POST

I have the following model: public class Product { public int Id { get; set; } public string Name { get; set; } private int CategoryId { get; set; } public Category Category { get; set; } public string InventoryDetails { get; set; } } I have an action in my controller which is used to create a new product. My question is how to l...

How do I access an unhandled exception in an MVC Error view?

When the HandleError attribute on a controller detects an unhandled exception and redirects to the Error view, I would like to provide the user with a brief description of the error, and an option to email the error to the application administrator. I do have a custom HandleError that notifies Elmah to log the error, but having to look ...

ASP .net performance analysis of web pages

Hi, I am working in ASP.net 3.5 MVC application. 1) Is there any standard for the response size returned by the web request( Say a good response size is 10k) and if it is more than that we may need to design the web page to return 10K or less. Sometimes when I see a response more than 60K I feel like that page might struggle a lot whe...

DataContext.Entity vs DataContext.GetTable<Entity>

I'm implementing the repository "pattern" in my ASP.NET MVC application. So i was doing some reading to decide whether i should expose the entire DataContext (initializing it in the constructor) or just the table via .GetTable<T> when performance is the most important factor. While doing my googling i ran into the following code at http...