Say you create a form using ASP.NET MVC that has a dynamic number of form elements.
For instance, you need a checkbox for each product, and the number of products changes day by day.
How would you handle that form data being posted back to the controller? You can't set up parameters on the action method because you don't know how many ...
This may not be the correct way to use controllers, but I did notice this problem and hadn't figured out a way to correct it.
public JsonResult SomeControllerAction() {
//The current method has the HttpContext just fine
bool currentIsNotNull = (this.HttpContext == null); //which is false
//creating a new instance of a...
Hi,
I have an ASP.NET MVC view which contains checkboxes for user-defined categories.
<td><% foreach (Category c in (List<Category>)ViewData["cats"]) {
if (selCats.ContainsKey(c.ID)) { %>
<input name="CategoryIDs" type="checkbox" value="<%=c.ID %>" checked="checked" /> <%= c.Name%><% }
else { %>
<inpu...
I've just started working with ASP.NET MVC now that it's in beta. In my code, I'm running a simple LINQ to SQL query to get a list of results and passing that to my view. This sort of thing:
var ords = from o in db.Orders
where o.OrderDate == DateTime.Today
select o;
return View(ords);
However, in my View, I rea...
I am very impressed with the ASP.NET MVC stuff--and I've seen the various blogs and am quite anxious to dig in. But where are the docs? I can't find any docs on the System.Web.Mvc namespace, or any of its related namespaces.
Google searches limited to msdn.microsoft.com don't turn up anything, nor does just googling. I know there are a...
On an ASP.NET MVC (Beta) site that I am developing sometimes calls to ActionLink will return to me URLs containing querying strings. I have isolated the circumstances that produce this behavior, but I still do not understand why, instead of producing a clean URL, it decides to using a query string parameter. I know that functionally they...
I'm building a CMS in ASP.NET MVC and want to allow users to pick which page they want to be displayed by default when the user first visits the site.
I set my default route in Global.asax, like so (for example):
routes.MapRoute(
"Default", // Route name
"{co...
Is it possible to use the asp templating engine (With the partial code-behind class, dynamic <% ... %> blocks and such) to generate non HTML? I want to have a clean and maintainable way to generate code dynamically. (Specifically, I want to generate LaTeX code populated with values from a database.)
Currently my LaTeX templates are res...
I work on a web game , I use asp.net mvc, linqtosql.
I have 3 tables that store default game values: DefaultRegions, DefaultSubRegions and DefaultCountries. These 3 tables are related to each other thanks to primary / foreign keys.
I need to copy the values of these tables into 3 tables called Regions, SubRegions and Countries when som...
I want to dynamically add menuitems to my master page based on membership security login role. From what I've read RenderAction in the master page html could perhaps do this. Since I'm fumbling thru this I am not sure how it would look and how in the controller I check my current role. I am considering creating a table and relating the a...
I am trying to create controller actions which will return either JSON or partial html depending upon a parameter. What is the best way to get the result returned to an MVC page asynchronously?
...
Hi,
I've just downloaded the ASP.MVC MSI package, but the installation fails with the "There is a problem with this Windows Installer Package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor." message.
I see that other people too have the same problem (http://forums.asp.ne...
I've been trying for a while now to write a unit test for a UserViewControl in ASP.NET MVC. I'd like to get to code that looks something like this:
[TestMethod]
public void HaveControlToDisplayThings()
{
var listControl = new ControlUnderTest();
var viewData = new ViewDataDictionary<IList<string>>(this.repo.GetMeSomeData());
...
In my main page (call it index.aspx) I call
<%Html.RenderPartial("_PowerSearch", ViewData.Model);%>
Here the viewdata.model != null
When I arrive at my partial
<%=ViewData.Model%>
Says viewdata.model == null
What gives?!
...
I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When I start my site (I'm still running using the ASP.Net Development Web Server) the default page gives me this error:
Server Error in '/' Application.
Using themed css files requires a header control on the page. (e.g. ).
Description: An unhandled exception occurred...
I've been reading about UpdateFrom, used to update a business object from the request. Is it massively susceptible to XSS code and extra form parameters being posted?
...
Hi. I'm using the ASP.NET 3.5 SP1 System.Web.Routing with classic WebForms, as described in http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/
All works fine, I have custom SEO urls and even the postback works. But there is a case where the postback always fails and I get a:
Validation of viewstate MAC...
Does anyone have links to tutorials regarding the new IModelBinder in asp.net mvc beta?
I can't get my head around it properly, so much has changed.
Thanks
...
We are moving from regular 2.0 webforms with no testing to TDD MVC
I'm looking to find out all the requirements for making the jump from 2.0 to 3.5 MVC.
Does SQL Server 2000 work with .net 3.5?
Does the MVC Framework come with .net 3.5?
How does AJAX work with all this stuff?
Is visual studios team suite worth the time/money?
...
I am on the way to build an ASP.NET MVC application with the latest beta release and I wonder if it is possible to change the default project Layout of
/Views/Home/Index.aspx
/Views/Home/About.aspx
to
/Blog/Views/Home/Index.aspx
/Blog/Views/Home/About.aspx
/Forum/Views/Home/Index.aspx
/Forum/Views/Home/About.aspx
The goal is to get ...