I have an ASP.NET MVC application. I have come to an idea of generating autoincremented values to be used as unique element ids. The question is, how can I have and work with a global variable which should be there for the duration of a request (page generation) but no longer?
I thought of using TempData for this shared variable and the...
I have an asp.net mvc application that I'd like to use forms authentication with two other asp.net apps that don't have the same machine key. Any thoughts on this? I don't have control of the machine keys for the other apps and they aren't the same.
...
I am sure this is a stupid question, but how would I get a pagedlist of filtered items?
Here is how I ended up doing it:
PagedList<Company> company = Company.GetPaged(1, 10);
var list = Company.Find(x => x.CompanyName.ToLower().Contains(query.ToLower()));
company .Clear();
foreach ...
I've been using ASP.NET MVC for a little while now and seem to find myself constantly returning things other than ActionResult from my controllers. I obviously return ViewResults but also JSonResults and also a couple of custom results that we've built in house.
I'm wondering tho, if, instead of declaring my controller methods like:
pu...
Is there anyway to retrieve a HTML element's class or ID in the controller class? Say for example, I have the following View:
<fieldset id="FeatureSelectField">
<legend>Extra Features</legend>
<div id="DeluxeFeatureID">
<%= Html.CheckBox("DeluxeFeature:fa")%>
fa
<br />
...
Hey,
I was wondering what the "correct"-way is when using a Linq to Sql-model in Visual Studio.
Should I create a new model for each of my components, say Blog, Users, News and so on and have all different xxxDataContext's with tables and SPROCs added in each of these.
Or should I create one MyDbDataContext and always work against that...
When developing WebForms web site, I start my project once, Cassini loads and stays loaded until I kill it. Therefore, when I change something (it recompiles in background), and refresh in browser is all it takes to see the changes.
But with MVC, I have to start debugging every time because Cassini is not responding to requests if debu...
I use the following HTML helper to generate check box:
<%= Html.CheckBox("DeluxeFeature")%>
Now I want to access the value of this checkbox in my controller. How should I do this? I am not going to use the method parameter name, for the reason that there are a lot of checkboxes and putting all of them in the parameter will clutter the...
I asp.net mvc my model classes won't show up in the Add View dialog, so that VS automatically can generate CRUD views for them.
I have my Model classes (Linq-to-SQL) in a separate project (but in the same solution) than my asp.net MVC project.
Only stuff from the Elmah and Autofac namespace shows up in the list!
...
I was lead to believe that MVC apps were BIN-deployable, so could be deployed to any ASP.net 3.5 compatible server. I'm trying to deploy to a Windows Server 2003 x64 with 3.5 (no SP1) and am having trouble getting it working.
I get the following when hitting the homepage, which redirects to the /Account/LogOn view due to our app config....
I want to start unit testing my javascript files as part of my build process in an MVC application I am building using jquery and jqueryUI.
I know how to use qunit and jsunit but I want to try and get VS to run these tests and integrate the results into my build process.
Has anyone got any ideas on where to begin with this? General poi...
I am trying to deploy a test ASP.NET MVC site to a site hosted on the Rackspace Cloud (essentially just the default site you get when you create a new ASP.NET MVC Web App in Visual Studio).
ASP.NET MVC does not appear to be installed so I have deployed the System.Web.Mvc.dll to the bin folder.
Now, when I access /Default.aspx I get the...
I find when I writing non UI code on a project I can be relatively productive (working in a top down manner from the service layer), following a TDD approach, Im nearly always out of the debugger until integration, not perfect but happy enough. FYI, I work in C# with R# enabled in VS2008.
However when I switch to stick a web interface ...
This is a very hard to explain question and I hope my code extract explains most of it.
Let's say you have the following database design:
And you want to build one generic interface to modify the musicstyle relations between all three entities. Currently I have created a MusicStyleController which requires the type of Entity it is rel...
Let's say I have an AddProductToCartTask with a method Execute().
Now, the task is being called from a Controller. In the Execute method , there
is a check that if not met - the action is not performed.
Let's say the message returned would be: "You do not have enough bonus to buy
this product".
I thought about launching an event when ...
I have modified the Nerd Dinner application to allow editing of child records by adding the following code to the DinnerForm.ascx
<p>
<%int i = 0;
foreach (NerdDinner.Models.RSVP rsvp in this.Model.Dinner.RSVPs)
{ %>
<%= Html.Hidden("Dinner.RSVPs[" + i + "].RsvpID", rsvp.RsvpID)%>
<%= Html.Hidden("Dinner...
I suspect this applies to general ASP.Net too but I am not sure.
If I have an action method on a Controller, say MyController.DoSomethingExciting and three clients hit it at "the same time", is it intrinsically thread safe, or do I need to do something to ensure that the three concurrent calls don't interact with each other?
...
Background
I'm receiving the following error when trying to render a partial view in ASP.NET MVC. I am new to ASP.NET MVC and am sure the error is simple to resolve and just stems from my lack of complete understanding.
Question (for those not wanting to read everything):
What is causing this error ?
Exception Details:
System.I...
I am attempting to write a common "menu.ascx" usercontrol in Asp.Net MVC that will generate a properly formatted HTML menu for my application. The menu is generated based on content in the database and a series of Resource resolutions... which are passed to the PartialView through an attribute on a ViewModel.
It would make sense to ut...
Hi,
Is it possible to have one .NET MVC application, and have it accessible from different domains, in such a way that the content will be domain-dependant?
For example, both www(dot)site1(dot)com and www(dot)site2(dot)com will point to my server's IP, and to the same website in IIS. In that website my .NET MVC application will reside....