Hi experts,
I have a view page with ajax.action link which returns a partial view from controller and render it to divid as updated target id.But I could not perform client side validation on that partial view.Can i have solution for it?
...
My partial view isn't being loaded. Please find my code snippets, I can't figure out what is wrong. Help please.
The error message is:
c:MvcUI\Views\Project\Details.ascx(42): error CS1950: The best overloaded Add method 'System.Web.Mvc.ViewDataDictionary.Add(System.Collections.Generic.KeyValuePair)' for the collection initializer
...
In mvc .net c# i have over loaded OnException action in my base controller
In controller action I have generated zip file using Ionic.Zip.dll
The code for this is like
foreach (var file in filesToarchive)
{
zip.AddFile(@file.FilePath);
}
zip.Save(Response.OutputStream);
var rept = reports.First();
return File(Response.OutputStrea...
I may be out of date, but one principle I adhere to is avoid nulls as much as possible.
However what I have found is that for a strongly typed view in which the user inputs the properties of an object I want to save, if some fields are not entered they are assigned as null.Then when you try to save the changes, the validation fails.
So r...
I am trying to use the ASP.NET MVC Codeplex Sitemap project with Custom Dynamic Node provider. This is my node provider code. It uses some repository to access the DB. I actually don't use DI in this class but the application inherits NinjectHttpApplication and the Sitemap has problems acquiring controller.
public class ContentPageDynam...
Hello,
I've asked a question to know why, in my application, textboxes are being highlighted (i.e. red border and pink-shaded backgroung are applied to the textbox) when I use modelbinding to validate the model (TryUpdateModel()) but not when I validate manually (ModelState.AddModelError). It has been 2 days now without any answer. I've...
I'm getting the "Potentially dangerous Request.Form request value was detected from the client" exception when im using my FCK editor.
How could encode before submit the form, or disable this validation without disable the Data Anotations validation?
This is the code of my view:
<% using (Html.BeginForm()) {%>
<%: Html.Valida...
Hello Everyone,
i have following two routes registered in my global.asax file
routes.MapRoute(
"strict",
"{controller}.mvc/{docid}/{action}/{id}",
new { action = "Index", id = "", docid = "" },
new { docid = @"\d+"}
);
routes.MapRoute(
"default",
...
<%: Html.HiddenFor(model => model.Name) %>
<script>
var name = <%: Model.Name %>
alert(name);
</script>
...
I'm trying out the new Razor view engine with MVC 3 Preview 1 and would really like to write a simple unit test using NUnit/Moq. I haven't seen any examples of this actually being done yet - despite it being one of the real selling features on Razor.
So, if I have a Controller, that uses a DBConext object (EF4 CTP code first) and the vi...
Hello,
Let's say I've the following model
public class MyClass
{
public type1 Property1 { get; set; }
public type1 Property2 { get; set; }
public type1 Property3 { get; set; }
public type1 Property4 { get; set; }
public type1 Property5 { get; set; }
}
I would, for instance, like to bind only the first 3 properties. How ca...
I'm using MVC 2.0 with a Html.ListBoxFor as below:
<% using (Html.BeginForm()) { %>
<input type="submit" value=">" />
<%= Html.ListBoxFor(x => x.lstTest, new MultiSelectList(new [] {"someone", "crap", "why"})) %>
<% } %>
When I click the input submit button below with nothing selected, it posts back fine, when I ...
How would I keep track of number of current sessions on my website?
...
I'm trying to do a “get” of a page, and pass in a list of ids that is stored in my cookie. My assumption was that it would be possible to get the cookie with the list from my request. However, I don’t get the cookie on the server side as I would expect. I only get a “user” cookie, but that doesn’t contain my info.
I want to try to avoi...
I am using Visual Studio 2010, but this applies to VS 2008 as well.
In my MVC views I prefer to write my coded elements as follows:
<% if (somecondition) { %>
<p>something</p>
<% } else { %>
<p>something else</p>
<% } %>
This just looks more readable to me than the following which is what VS auto corrects my code to look like...
Currently, I have code like this :
<% if (consumer.IsDischarged)
{ %>
<%= Html.ActionLink("<img src=\"../../Images/ConsumerImages/computer_go.png\" alt=\"discharged\" style=\"border:\"0\"/>", "Details", new { id = consumer.ApsId })%>
<%}
%>
Basically I want to show the hyperlinked image whenever the status of the isDi...
Hello SO,
I'm using LINQtoSQL to create cascading deletes IE: if Category is deleted then all the Products in that category are also deleted.
I have a Products repository set up already (IProductsRepository) and now I'm working in my Category repository to add the business domain logic for the cascade.
Products repository has this met...
Is it possible to keep my existing .master page and have it used with a new ASP.NET MVC 3 Razor view? I tried this:
@{
LayoutPage = "~/Views/Shared/Site.master";
}
And it gives me this error message:
The file '~/Views/Shared/Site.master' could not be rendered, because it does not exist or is not a valid page.
...
I'd like to have a list that will shorten a field value if it is too long from a linked Entity Data Model. Something where I could take the following:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcDR.Models.DONOR_LIST>>" %>
<asp:Content ID="Content1" Content...
The error is:
An error occurred while creating a
controller of type 'foo'. If the
controller doesn't have a controller
factory, ensure that it has a
parameterless public constructor.
However, fooController has a parameterless public constructor. I'm using the default factory. As far as I know, this code was working, and n...