This is my first MVC app and I'm not sure how to use a parameter to filter the returned data. I'm using MVC2 and Visual Studio 2008.
How do I filter view results based on user input? I want the user to be able to enter an ID number in a textbox and then click a button to get results filtered by the ID they entered.
here is my Control...
Hello everybody,
First sorry for my bad english, i'm french. I'll try to make me understand :)
I'd like to pass a parameter from view to controller without using the url.
Why? Because the parameter is a userid and I don't want somebody change it manually in the url.
My code in view :
<% foreach (var item in ViewData["ClientsLis...
Although I have read the documentation on Html.HiddenFor, I've not grasped what is it used for...
Could somebody explain its uses and give a short example?
Where should those helpers go in the code?
...
I have an MVC view that changes a few small UI elements based on the user's role. Currently it modifies the output using a few if() statements using a couple boolean values I sent to the view through the viewmodel. However, it doesn't seem like a very good approach, so what I'd like to do is move this all into either an HtmlHelper clas...
I have a Web Deployment Project in my solution. The solution consists of the MVC2 App and another Class Library.
In the Web Deployment Project properties I have the Merge all outputs to a single assembly option ticked and I have given it a name.
When I look in the bin folder I have all my reference DLL's from my MVC app, a DLL with th...
This may be an easy question, but if it is one i haven't found a solution. I have a view model that is updated when a button is pressed, and on the update an IList within it will be given some results (this i know works). However i am trying to bind this Ilist to a gridview within the view page. Every time i try to assign a datasource or...
I am rather new to MVC applications, and one thing I am trying to accomplish is enabling or disabling stylesheets based on a Session value.
I have stylesheets referenced in my Site.Master page in this manner:
<%=Html.Stylesheet("~/styles/main.css", "string")%>
<%=Html.Stylesheet("~/styles/additions.css", "string")%>
Right now, for tes...
For an MVC 2 app that relies on many partial views and almost exclusively uses Ajax for POSTs/GETs, what would be the best way to implement the setting, passing, retrieval and display (using a JavaScript modal) of these messages?
My forms all POST (by way of jQuery $.ajax) to actions that return partial views (html) that are used to upd...
I have two buttons inside a form call:
<% using (Html.BeginForm()) {%>
<input type="submit" value="Filter" />
<input type="reset" value="Clear Filter" />
The fields in question:
<td>
<%:Html.TextBox("filterId", Model.IdFilter, new {style="width:100px"}) %>
</td>
<td>
<%:Html.Te...
I often create several sub domains of a web project, such as blog.domain.com, www.domain.com and example.domain.com. Typically I set these projects up within a single solution, along with any common class libraries, and assign each a static port number. To view a specific site I right click a file in the solution explorer and "View in ...
I have a multilanggual website. I would like to store Locatilzation in database instead of ressource file.
If somebody has good tutorial or documentation about that, I appreciate to access these doc.
...
I have encountered an issue when trying to serve files with spanish tildes, related to the Content-Disposition encoding.
The file name is "qué hacés ahora.docx"
So far, the ASP.NET MVC way of serving files adds this header, which works fine only in Firefox:
Content-Disposition: attachment; filename*=UTF-8''qu%C3%A9%20hac%C3%A9s%20ahor...
Hi,
I have an ASP.MVC 2 web page and I have my authentication done like this:
FormsAuthentication.SetAuthCookie(user.UserName, false);
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, "fooPage" + user.UserName, DateTime.Now, DateTime.Now.AddMinutes(10), false, String.Empty);
HttpCookie cookie = new HttpCookie(F...
Hey everyone, there's one thing bugging me for quite some time now. How can I create a setup project (resulting in a msi package) for my Asp.Net Mvc 2 Project? The installer / msi should create a website in iis7, a database in SQL Server 2008 and put the connection string(s) into the web.config. What is the best way to achieve this? Does...
Are Models and Domains and Repositories essentially the same thing?
...
I have created a partial view that I'd like to be able to re-use on different pages of my website.
Currently, for each webpage I create a ViewModel that collates all the information I would like to show and then I send it to the view which compromises of 3 separate partial views. Here is a simplified example:
public ActionResult Index(...
I have a partial view (.ascx) that should include its own CSS file as it's used in multiple other views. How do I inject a stylesheet in the page server-side, i.e. without using JavaScript?
...
Following on from an earlier question, I'm having problems using an Editor template for datetime fields, below is the code for the editor template (called "EditDateTime").
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %>
<%= Html.TextBox("", (Model.HasValue ? Model.Value.Date.ToString("dd/MMM/yyy...
I have this code that works.
public class HelloWorldController : Controller
{
UAStagingEntities db = new UAStagingEntities();
public ActionResult Index(int? id)
{
var depot = db.CSLA_DEPOT.Where(c => c.DEPOT_ID == id.Value);
return View(depot.ToList());
}
}
What I don't know how to do is display a v...
We're currently building a Webapp that serves multiples subdomains (wildcard subdomain). In our app, users may be authenticated for one or many subdomains (just like Basecamp does).
We want to know what's the best strategy to save and load users credential. The main problem is that our users may have differents roles in differents s...