Okay, I'm really struggling with how to update a list of foreign keys in MVC2/EF4.
I have a one to many relationship between a Template object which can have many or no TemplateScenario objects.
Essentially, I have an edit method in a controller that is trying to do this:
// POST: /Modes/Edit/1
[HttpPost]
public ActionR...
Is it possible in MVC2 to create an anchor tag that contains values from ViewData?
e.g.
<a href="mailto:<%: ViewData["Email"] %>">Send Email</a>
This code above doesn't render and just throws an exception?
...
I published a site with a web hosting company and when someone hits the URL for the first time they are being prompted to log in using basic authentication. If you hit Cancel the site loads successfully and the user is not prompted again with the dialog box.
I contacted support and they are telling me (in a canned response) that it’s a...
In my MVC2 site if a user enters lt/gt signs in a password box an exception is thrown because of "potentially dangerous..". ValidateInput(false) on my controller solves it but for something so simple (not html passing) yet needs to be protected what is a better alternative? I've briefly looked at http://wpl.codeplex.com/ but it also seem...
I have the following class
public partial class Contact
{
public Contact()
{
}
#region Primitive Properties
public virtual int Id { get; set; }
[Display(ResourceType = typeof(Common), Name = "Person_Name")]
[Required(ErrorMessageResourceName = "Validation_Required", ErrorMessageResourceType = typeof(Common...
I found this solution on here http://stackoverflow.com/questions/2782815/how-to-update-strongly-typed-html-dropdownlist-using-jquery and am trying to implement it, but something is bugged in it.
$(function() {
$('#cid').change(function() {
var selectedCompany = $(this).val();
var ddl = $("#foid");
$.post("/Ti...
I have 2 namespaces for my controllers. One is the default MyProject.Controllers and the second is MyProject.Controllers.Framed. I am using namespaces so that I can have a url like /home/index serve up the normal home website and /framed/home/index serves up a version intended for use in an iframe.
My problem is that when I put <%: Ht...
Hi Guys,
Has anybody mocked Request.Form in NMock2. I found a sample for MOQ but dont know how to translate that in NMock2.
var request = Mock.Get(controller.Request)
request.Setup(r => r.Form).Returns(delegate()
{
var nv = new NameValueCollection();
nv.Add("UserName","SomeUser");
nv.Add("Email","[email protected]");
retur...
I have few questions based on following scenario:
I have a LoginController with following methods:
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult Login(UserObject user)
{
Calling Besiness Service to Validate User againts DB (Using Repository)...
if (success)
{
return RedirectT...
I've created an HtmlHelper that helps me show a jQuery modal dialog: I set a message in controller's TempData and if the message is not null, the helper writes an jquery + html code to make popup apears after postback.
But I need to show the Validation results as a message (same message displayed by ValidationSummary), and I have no Ide...
Hi All,
I have a small form with a single textbox and a submit button.
using (Html.BeginForm("Index", "Tag", FormMethod.Post)
In my tag controller i have a method that looks like:
public ActionResult Index(string tagText)
I'm trying to figure out first how to route this so the resulting URL will look like:
http://mydomain.com/Tag...
Hi,
I have a menu which is created from the database.
When the users navigate through pages the current page is highlighted with the css class.
Menu is rendered with the Html.RenderAction("Menu","Home");
Because of being datadriven menu i use the new ChildActionCache attribute which is in the ASP.NET MVC 2 Futures project to cache t...
I have a dropdown list that is populated on a content page like this
<%: Html.DropDownListFor(x => x.SelectedName, Model.NameList) %>
<input name="btnGo" type="submit" value="GO" />
When the user selects the name and click the GO button, I have an HTTP Action that gives me the name
[HttpPost]
public ActionResult SelectName(string S...
I have the following 2 classes:
public class SomeClass
{
public int SomeClassID { get; set; }
...
}
public class AnotherClass
{
public int AnotherClassID { get; set; }
public int AnotherClassText { get; set; }
}
I have a ViewModel that contains the following:
public class MyViewModel
{
public SomeClass { get; set; }
publ...
Hi,
I have output caching implemented at controller level
[OutputCache(CacheProfile = "MyProfile")]
public Result MyControllerAction()....
I have some text in matching view (Views/MyController/MyControllerAction.aspx) that needs to change with each page load, even though the returned page is cached. I think this is also called donut ...
Is there any way to look at all the data annotations or attributes available in Asp.net MVC?
i.e. for validation we have "Required", "StringLength" etc, for Action verbs, "HttpPost", "HttpGet" etc, similarly "Bind", "MetadataType" etc.
I am kind of new to Asp.net MVC and MVC is loaded with attributes for different purposes and I don't k...
I use Framework Entity 4 in my project.
I would like to create a function that will return an Expression
Nothing seem to work. I get this Internal .Net Framework Data Provider error 1025.
Here is my Expression Method
public Expression<Func<SupplierTypeText, bool>> GetLmbLang()
{
return (p => p.LangID == 1);
}
I call...
Hi, i have an asp.net mvc 2 application, and have some jquery that defines behaviour of two dropdownlists. When one changes, the other is populated with filtered data. After much furor, i have the jquery working, confirmed by firebug debugging, but my dropdownlist is not refreshing. This is the jquery
<script type="text/javascript">
...
i'm starting to develop an asp.net mvc cms.
i want to backend for administrator and frontend for users,
how i need to build my structure?
for now the cms will handle just simple pages with title and body.
in the frontend i need to show the menu (pages).
in the backend i need to allow view pages list, crud (create,read,update,delete) pag...
I am developping an intranet ASP.NET MVC2 application for a small business. The small business has multiple type of printers and depending on what is required a print request will be sent (from the browser/user) to the server and the server will dispatch the print job to the right printer accordingly. Please note that it is a completely ...