How should I create application wide utility/manager classes that read settings from the database?
Should I use static classes e.g.
public static class ThemeHelper
{
private static string themeDirectory { get; private set; }
static ThemeHelper()
{
// read from the database
themeDirectory = "blue-theme";
...
Hello
In an ASP.NET MVC 2 application, i'm having a route like this:
routes.MapRoute(
"Default", // Route name
"{lang}/{controller}/{action}/{id}", // URL with parameters
new // Parameter defaul...
What would be a performance impact if I wrapped every call to an action link (ex. <%=Html.ActionLink(....)) inside a partial view. So in other words instead of calling html extension method for actionlink I would call a html extension method for rendering partial view, and my partialview (user control) would execute the Html.ActionLink(....
Hi,
I have a domain object Thing which can contain several Categories. So I have implemented my HTML helper to create a checkbox group of all possible Categories. I have no problem receiving:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Thing Thing, List<string> Categories)
However I am wondering whether I could use a cus...
What is the best way to do entity-based validation (each entity class has an IsValid() method that validates its internal members) in ASP.NET MVC, with a "session-per-request" model, where the controller has zero (or limited) knowledge of the ISession? Here's the pattern I'm using:
Get an entity by ID, using an IFooRepository that wrap...
I just started building a small simple Website on ASP.NET MVC, in a page I am using a Partial view, the Partial View represents a simple Form which should be submitted on button click, and If I click the first Time it is submitted with success and does return my partial view with my validation Messages (if the content is invalid) but if ...
I'm using jquery to dynamically create a list of checkboxes. However, when there's an error, I need to preserve the state of the checkboxes.
I have this working, but it seems a bit kludgy: get the value from the posted form, put it into viewstate, put the value of the viewstate var into a hidden field, get the value of the hidden fie...
I have a table with a few rows of data. I would like to display a row based on what option is selected on the ddl. how do I do that?
<script type="text/javascript" language="javascript">
function optionSelected() {
alert('HELP!!');
}
</script>
...
<select id="optionSelect" onchange="optionSelected()">
<option i...
I'm writing an ASP.NET MVC application that uses Forms Authentication. The target clients are a variety of mobile web browsers.
When I use the BlackBerry 8530 simulator my MVC app authenticates as expected. I can visit pages whose controller methods are decorated with the [Authorize] attribute - no problem - they display and therefore I...
I'm rather new to MVC and as I'm getting into the whole framework more and more I'm finding the modelbinders are becoming tough to maintain.
Let me explain...
I am writing a basic CRUD-over-database app. My domain models are going to be very rich. In an attempt to keep my controllers as thin as possible I've set it up so that on Create...
I have what seems like a common issue with SaaS applications, but have not seen this question on here anywhere.
I am using ASP.NET MVC with Forms Authentication. I have implemented a custom membership provider to handle logic, but have one issue (perhaps the issue is in my mental picture of the system).
As with many SaaS apps, custo...
I am using ASP.NET MVC2 and Entity Framework. I am going to simplify the situation a little; hopefully it will make it clearer, not more confusing!
I have a controller action to create address, and the country is a lookup table (in other words, there is a one-to-many relationship between Country and Address classes). Let's say for clari...
Hi there.
I have an ASP.NET MVC web site.
I have many actions which require authentification to be performed. So, I need the user to get redirected to the login page, and after login(if successful) to be redirected back.
So what I want to do now is to build a new class, smth. kind of seen below:
class AuthChecker
{
public AuthCheck...
I am following the following tutorial (http://www.highoncoding.com/Articles/642_Creating_a_Stock_Widget_in_ASP_NET_MVC_Application.aspx) on using ajax to render a partial form , but in this example parameters are not passed, and I have not been able to work out how to do it...
This code works with no parameter
function GetDetails() {
$...
I want to copy an ASP.NET MVC website to a remote IIS 7 server using WebDAV. I have created a site in IIS, enabled WebDAV and assigned a special application pool I have named "WebDAV Application Pool". Using a Windows 7 or Vista client I'm able to mount the remote site as a network drive. So far, so good.
However, I have problems upload...
I'm using LINQ to SQL to connect my database to my home page. I created my datacontext (named businessModel.dbml) In it I have two tables named Category and Business.
In home controller I reference the model and attempt to return to the view the table:
var dataContext = new businessModelDataContext();
var business = from b in dataConte...
Hi,
What's the best way to set up a controller to sort by many (possibly null) criteria? Say for example, I was building a site that sold cars. My CarController has a function Index() which returns an IList of cars to the view, and details on each car are rendered with a partial view.
What's the best way to structure this? Especial...
Hi
I am using Ajaxy Call to load the partial view. It is working fine in Firefox and IE without in Debug Mode.
But in Debug mode, I am getting the follwoing error:
Error: 'Sys' is undefined
Ajaxy call Code:
<% using (Ajax.BeginForm("SearchResults", new AjaxOptions { UpdateTargetId = "divLoadSearchResults" } ))
{%>
HTML View Sourc...
I've got an ASP.NET MVC site & I've got an Errors controller with a NotFound action which works great for 404 errors that pass though .NET, but for stuff that doesn't (like static files) I've set the Custom Errors value for 404 to URL with a value of /Errors/NotFound.
But when I do this & hit a non-existant page the site just gives me...
I'd like to use SSL for the post action on the login page of my MVC 1.0 app. I've seen some articles related to the [RequireSSL] attribute in ASP.NET MVC Futures. However, since this works using a redirect, I assume it's not an option (can't redirect a POST, correct?).
Ultimately, my goal is to get the Html.BeginForm method to render ...