I have a fairly simple web app that uses cookies to store some information about the user and to authorize them on each request. When the user first logs into the site a cookie is created and some encrypted information is stored in there, the expiration is set for the current time plus 24 hrs.
What I want to achieve is that whilst a user...
I am writing a questionnaire application with ASP.NET MVC 2.
I have a set of questions that require a response of yes, no, unsure.
These need to be images that return a value to the questionnaire controller.
What is the best approach for adding image buttons?
...
There are a whole bunch of tutorials out there explaining how to do this, eg here and here.
Looks real easy huh? Yet I've still somehow managed to waste half a day on it without getting anything working.
Eg: the following works absolutely fine
public ActionResult FindStuff(string q)
{
return Content("test");
}
$('#MyTextBox').aut...
I have this to populate a drop down list in an ASP.NET MVC view.
<%= Html.DropDownListFor(model => model.Bikes,
Model.Bikes.Select(
x => new SelectListItem {
Text = x.Name,
Value = Url.Action("Details", "Bike", new { bikeId = x.ID }),
Selected = x.ID == Model.ID,
})) %>...
I'm using StructureMap 2.6.1
This is the code from Bootstrapper.cs:
ObjectFactory.Initialize(x => x.For<IFoo>().Use<Foo>());
When I run application, I get the following exception:
No Default Instance defined for
PluginFamily
IFoo,
Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
I don't get an exception when I use t...
I'm trying to write my own little HTML helper which acts a lot like DropDownListFor but which doesn't suffer from the same problems that I've encountered before. Let's not discuss whether or not DropDownListFor is flawedthat is not what this question is about.
Anyways, what is the reason that the MVC guys make ToMvcHtmlString internal a...
I am trying to figure the best way to manage my javascript code for my MVC project. A few pages of my site are very heavy with javascript for the user interface due to the workflow of the pages.
In order to make development and debugging easier I split all my javascript into four .js files, Initializations.js which has all the functi...
I get an error message "Object reference not set to an instance of an object." when I try to use an UserRepos repository. Question is how can I resolve user repository at the start of the application (ASP.NET MVC) What is wrong here?
public class MyApplication : HttpApplication
{
public IUserRepository UserRepos;
public IWindsor...
Hi, i was wondering if it was possible to filter which action is invoked based on a paramater in the query string.
For example, i have a grid with a radio button column to select an item in the grid. The grid is wrapped in a form and at the top of the grid are buttons to edit/delete the selected item. Clicking on the edit/delete butto...
Does anyone know how to ensure that files and directories that exist do NOT get routed to .NET MVC if they exist in the root directory?
With Zend Framework, this is done in the .htaccess like so:
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
How is this accomplished...
Hi,
I tried to implement an autocomplete field using jquery:
$('.autoComplete').autocomplete({
source: function (request, response) {
$.ajax({
url: "keywords", type: "GET", dataType: "json",
data: { term: request.term, maxResults: 10 },
sucess:...
As I review more code and blog posts from lots of MVC sources, I still haven't wrapped my mind around what is "posted" when a request is made. I realize MVC doesn't support post, but I'm having trouble finding resources that can explain it well enough to understand.
Inside the controller's public ActionResult nameOfAction(what the heck...
Razor view engine looks promising, so I thought it would be good to contribute with ideas and compile a wish-list of Razor features while the development is just in preview stage.
What are the features you miss today in Spark, Webforms, or early Razor release and would like to be implemented in Razor?
UPD: Why close this question??? Wh...
I am not a web programmer by any definition. I am more interested in the language and some low-level stuff. I like a simple, small language like C that has a fairly small grammar set with a vocabulary that is fairly large. I like programming in an environment where I know what's going on. I feel very awkward working with frameworks that ...
I have a pair of routes that both point to the same action and depending on the supplied route data I would like one route to be chosen over the other. Trouble is, the routing engine seems to be automatically appending route values that I am explicitly telling it not to.
routes.MapRoute(
"Products_Search_Paged",
"products/search/page{...
Where can I find a decent tutorial/explanation of using Castle Validators with ASP.NET MVC2?
I want to go with Castle because I'm not fond of the fact that I can't test my POCOs using Data Annotations without copying the logic of grabbing the attributes and calling isValid on all of them. I'm much more fond of the fact that with Castle ...
Currently, I have a set of stored procedures which are called to populate different fields on a page. I am calling the stored procedures from the LINQ to SQL class that I dropped them on, which works fine. However, it automatically generates (StoredProcedureName)Result class names which I have to work with.
Is there anyway to take a s...
Hello friends,
I have this code for Form Submit..
<input type="submit" runat="server" id="buttonSubmit" value="Add" style="width:100px;" />
My BeginForm is like this..
<% using (Html.BeginForm("Insert", "StudentController", FormMethod.Post, new { @id = "exc-" }))
{%>
I have one textbox in my view I need to check my textbox ...
I just moved my site to my server which is windows 2003 sp2, sql 2005.
I have a mvc site running on my server (althought i have it turned off) it works fine but my new site does not work correctly
For some reason the routing fails to work on my server. I can hit the homepage fine using the domain but clicking on any link(or typing it i...
I'm trying to secure my MVC routes from a set of users that meet a set of criteria. Since MVC seems to use attributes quite a bit and Steven Sanderson uses one for security extensibility in his pro MVC book I started heading down this route, but I'd like to define the rule contextually based on the action I am applying it to.
Some acti...