i am getting this error on the asp.net mvc default site when i try to log in:
An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
Parameter name: connectionString
this is in the file "Accou...
I have a ProductController with actions Index (which Loads a blank form). The form also posts to itself as its a complex form and the form elements like dropdowns show posted values
the code is as follows
public ActionResult Index()
{
int id;
id = Convert.ToInt32(Request.Form["ddlLendingType"]);
if (id == 0)...
Imagine the scenario you have a listing page that is a concatenation of multiple entities on your site (such as a search page).. you collate all the entities of your site in the action, and map all of them into a generic view model type..
pseudo:
from articles, posts, projects
orderby rating
select top 50 as 'SearchResult'
My search ...
Hi,
I want to use the error message returned by a RuleViolation as the validationMessage of the Html.ValidationMessage(modelName, validationMessage).
Simple Example: Person.cs
public partial class Person
{
public bool IsValid
{
get { return (GetRuleViolations().Count() == 0); }
}
public...
How do I recreate the form prepopulated with posted data when the validation fails and the ValidationSummary is fired off. I get the validators firing but cannot get a way to prepopulate the form.
catch (Exception ex)
{
TempData["Message"] = "An Error Occured while saving the product!";
ModelStateDictionary modelDictionary = Val...
So as the title suggests I wish to create a new dom element (the HTML is generated and retrieved via AJAX). I kind of got it working but it appears hidden, and when I try to Fade In it breaks!
function AddContent(Content) {
div = document.createElement(Content)
div.appendTo($("#contentAreas"));
// $(div).f...
I use RenderAction to render a partial that is used all over my site.
It is a partial where the user can search for an entity. It depends on the Controller / Action that rendered the parent main view what is done once the entity is found.
Lets say I have the controllers:
HireController, FireController with
Action ActOnPerson and...
I want to store additional information on my users (address, phone).
Should I extend the registration page on the sample mvc template or should I set up a separate "profile" table and have that be a separate page?
It seems nice to do it on the registration page, but I am not sure if there are issues playing around with the "aspnet_"......
Okay, so maybe this is a no no in the MVC pattern in which case, that's the answer I'm looking for. However, let's say I have some content html in a database and I want to pass it through to the view. I am assuming I could use a ViewData property to pass this through to the page. What sort of massaging do I need to do to the string to ge...
The main website will be MVC but I have a need for one Silverlight control to allow users to draw on images, just basic shapes, lines, squares, triangles etc.
Also might need Silverlight control to potentially allow users to draw and annotate video clips.
Is this possible?
...
how do you change the width of a textbox in an asp.net-mvc View
i want to have these fields side by side and the state textbox much shorter width
<p>
<label for="city">City:</label>
<%= Html.TextBox("city")%>
<label for="state">State:</label>
<%= Html.TextBox("...
The following is taken from page 56 of Professional ASP.NET MVC 1.0.
When we look at the Details.aspx template more closely, we’ll find that it contains static HTML as well as embedded rendering code. <% %> code nuggets execute code when the view template renders, and <%= %> code nuggets execute the code contained within them and the...
I'm presenting data for users in a grid (ExtJS) with remote sorting and paging. Let's say I have a grid with some Orders. Order entity looks like Order{OrderNumber, Customer, Date, Address{Street, City, PostCode}}. Customer is mapped by NH as relation, Address is mapped as component. Data presented in the grid are flattened to columns na...
I'm passing data between my controller and my view using a ViewModel class. When there are validation errors, I return the ViewModel back to the view so the user can see the errors.
I'm having trouble figuring out the best way to deal with the data that is only passed from the controller to the view, which isn't passed back to the contr...
I need to do something fairly simple: in my ASP.NET MVC application, I want to set a custom IIdentity / IPrincipal. Whichever is easier / more suitable. I want to extend the default so that I can call something like User.Identity.Id and User.Identity.Role. Nothing fancy, just some extra properties.
I've read tons of articles and questio...
Hi all,
I'm using MVC, I've got a search page, and I want to pass multiple arguments to
the next page.
I want to wrap these multiple parameters into an Object (CV) and pass it to the next screen, not just pass all the args individually via the query string.
I'm sure there are lots of ways to skin this cat, but what's the MVC approve...
Hi,
I'm looking for a best practice suggestion.
I've got a ShoppingBag Controller with a Partial that lists all the items in the user's bag. In this Partial you can remove items from the bag via a form post.
The Partial has been place in a Master Page which is referenced by each of the Views in the Controller. When an item is removed ...
If I have an Invoice Line Items table and a Products table, and I have a dropdown in my invoice line items to select a product, I will need a SelectList to populate the dropdown with product names.
Which repository do I put the product SelectList method in, the Invoice Line Items repository or the Products Repository? To me it makes ...
I have a new asp.net mvc project and i am trying to figure out the best place to store images and also how i would reference them from site.master (in cases where i have a header images that i want to show up on all pages).
Suggestions or best practices?
...
I am having a problem where a cookie I am setting is being lost directly after RedirectToAction() is called. Is something going on behind the scenes that invalidates the current request and creates a new one that causes the cookie to be lost before it has been persisted to disk?
I understand that if you want data to be available after ...