Hi all. I have problem with uploading image to SQL database.
i have Methods Upload in controller Upload
dbData userDb = new dbData();
public ActionResult Upload()
{
return View();
}
[HttpPost]
public ActionResult Upload(HttpPostedFileWrapper file)
{
if (file.ContentLength > 0)
{
Stream fileStream = file.InputStrea...
I've started working on my master's project and decided to try something new and use ASP.NET MVC 2. I have Windows 7 Pro and Visual Studio 2010.
I've been following this tutorial http://www.asp.net/mvc/tutorials/mvc-music-store-part-1 and what's driving me insane is that I cannot even get past the first step. I setup my project exactly ...
Hi,
I am working on a plugin system for Asp.net MVC 2. I have a dll containing controllers and views as embedded resources.
I scan the plugin dlls for controller using StructureMap and I then can pull them out and instantiate them when requested. This works fine. I then have a VirtualPathProvider which I adapted from this post
public...
I'm constantly confused about how to pass values between Views and Controllers in MVC. I know I can set ViewData in the Controller and use that in the View, but what about the other way around?
What I have found is I can use a hidden field and then access it through Request.Form["name"] like this:
<% using (Html.BeginForm("Upload", "Cu...
Hi
I am wondering how do I make pages automatically use https? Like if a user types in
http://www.mysite.com
It should take them right to the login page. However I have SSL required on this page(when they try to login).
So how could I make it so it would change it to
https://www.mysite.com even if they don't type it in themselfs?
...
I have two tables: Area and Boss.
An Area has a Boss, it has a foreign key relationship of Area.IDBoss and that is Boss.ID. I hope I'm explaining my question properly. :P
As of now I can manually type in a number in the textbox and it saves correctly, I can also display the name correctly because I'm using Entity Framework, something l...
tldr> Once a customer has been selected, how can all other controllers execute their actions always in the 'context' of that customer without manually passing the ID around?
I'm trying to figure out what the 'right' way is to handle the situation where one entire controller (or more) are all dependent on an idea from a previous controll...
Hi,
I have a string contains a URL. How do I check which route in RouteTable.Routes matches my url?
I used reflector to investigate how it is done in Phil Haack’s RouteDebugger. I found it internally works based on HttpContext. I don’t have the HttpContext as url is not requested yet.
Thank you,
Max
...
I have an application that I've been using xVal successfully on for quite some time. It was recently updated to MVC 2.
I use the standard DataAnnotations attributes on my domain models, which also implement a "Validate()" method that calls the DataAnnotationsValidationRunner. If there are any errors, that method throws a RulesExceptio...
i have a java script dictionary. its dictionary<string,dictionary<string,string>> if it is helpfull.
i cant pass it to controller class using jquery ,ajax
is ther any way to do that?
<script language="javascript" type="text/javascript">
var dictionary = {};
var props = {};
props["test1"]="test1";
props["test2"]="test2";
props["test3"...
Server Error in '/' Application.
The model item passed into the dictionary is of type 'Develosoft4.Models.Cita', but this dictionary requires a model item of type 'Develosoft4.Models.CitaFormViewModel'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more i...
Hi Guys,
I'm having a problem with mutliple form buttons. I've got a DB table which lists all of my categories, these are placed into a form in the form of image-buttons. They all have the same name and their value is the ID from the Category's table. So I've got a form with a number of buttons;
<input type="image" value="<%= Html.Enco...
How to disable element prefix in asp.net mvc2 template?
Should I use Partial Control Instead?
...
When using the following code, the id's of the field and the id in the for attribute of the label isn't identical.
<%: Html.LabelFor(x => x.Localizations["en"]) %> => Localizations[en]
<%: Html.TextBoxFor(x=> x.Localizations["en"]) %> => Localizations_en_
<%: Html.LabelFor(x => x.Localizations["en"].Property) %>
=> Localizati...
Consider the following setup:
Model:
public class Product
{
[ReadOnly(true)]
public int ProductID
{
get;
set;
}
public string Name
{
get;
set;
}
}
View:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<MvcApplication4.Mo...
Hi Overflowers,
Hope somebody can help this poor distraught noob. I have inherited another devs app and I'm trying to add some much needed functionality to it. The issue in question is creating an Invoice from a crystal report that can be downloaded as a pdf. I got the code working in Visual Studio (It's a C# MVC application, built on...
On an asp.net mvc 2 app, I'm using Unity 2.0 interception app for various types of logging where every log entry requires the id of the current user.
Currently I'm passing the User object as an argument to service and repository methods. The only reason I'm doing this is so that it's available on MethodInvocation.Argumants for the interc...
There seems to be no extension method to include some arbitrary route values that normally I would expect to go into the querystring.
Old code:
<%: Html.ActionLink(Model.ParentMessage.Category.Text, "index", null, new { category = Model.ParentMessage.CategoryID }, new { })%>
I want to change it to this but it takes the category as an...
The following returns "/Settings"
Url.Action("Index", "Settings");
On my local this renders fine. However on my remote machine I get the error belows. I get the impression that the controller is not properly instantiated.
Parser Error Message: Could not load type 'System.Web.Mvc.ViewPage<EStore.Domain.ViewModel.SettingsViewModel>'....
My master page has doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
In this page I want to use empty elements like:
<input name="X" type="hidden">
After opening the page in my browser I check the source and see that all empty tags are closed like so:
<input name="X" type="hidd...