Hello,
I need to display in image on the view this way
<img src = <% = Url.Action("GetImage", "Home", new { productID })%>
This is the action which's supposed to supply data
public FileContentResult GetImage(int ID)
{
var img = db.Images.Where(p => p.ID == ID).First();
return File(img.ImageData, img.ImageMimeType);
}
This exam...
i want a facility that if user login then goes to home/index
i not want to use
return view('~/views/home/index');
i want to redirect it to a actionresult index of home controller of my web-application(in asp.net mvc)
how i can do this without return view(); i want to redirect him.
public actionresult login
if(userlogin)
{
// go...
We've recently developed an internal web application for our intranet on top Microsoft's MVC Framework (v2). This seems to work wonderfully, but after some as yet unknown events, we're seeing a situation where database queries appear to yield no results, whilst no exceptions are caught, which has stumped me somewhat.
Republishing the ap...
Hi,
I am deleting things like this:
[Transaction]
[AcceptVerbs(HttpVerbs.Post)]
public RedirectToRouteResult DeleteQualitativeGlobalFeatureValue(string Id)
{
try
{
BlaService.DeleteBla(Id);
}
catch (Exception e)
{
ModelSt...
Strange question, I know, but one thing I seem to be feeling with ASP.Net MVC is that it's smoother and more logical to try and avoid form-submissions unless totally necessary (especially if you have more than 1 on a single view).
As an example, you have a list of items and you can sort the items, to me it seems to be a more 'fitting' i...
I am lost with the submission of listbox with multiple itmes selected and with group of checkboxes.
If that was a WebForm project it wouldn't be a problem for me.
What are the best practices and maybe some code samples that show proper submission of form in ASP.NET MVC2 that contains group of checkboxes and listbox with mutiple selecte...
I'm creating a tabcontainer that shows information from partials. The code that i've created is as follows:
//Entering extension method, m_helper is of type HtmlHelper
foreach (var tab in m_tabList)
{
sb.AppendLine("<div class='tabContent'>");
m_helper.RenderPartial(tab.PartialName);
sb.AppendLine("</div>");
}
//Returni...
Hello,
I'm doing kind of wizard application that captures information on Contacts. So, before saving to DB, all data collected during the process are kept in memory as model's properties (using serialization/deserialization). Data collected includes the uploaded picture of the contact. The last page is called "preview" where I display a...
I saw this implemented somewhere but basically below I'm using the textbox HTMLHelper to draw a textbox with the id myID and default text 'text_goes_here'. I want to also add a class to thiis helper, i saw somewhere it implemented with new {@class =''} as a third parameter creating an object but im not sure exactly how its wrote
<%= Ht...
Hi,
I just noticed to my surprise that whitespace at the start or end of form parameters is not automatically removed in ASP.NET MVC 2 (browser: Firefox).
I always assumed this would be the case, simply because I could not see a scenario where I would NOT want trimming to happen by default.
This can be fixed very easily by implement...
Hi
I have a really strange ‘bug’. I use this in my view:
<% foreach (var QualitativeGlobalFeatureValue in Model.PossibleValues)
{ %>
<% using (Html.BeginForm("DeleteQualitativeGlobalFeatureValue", "Features", FormMethod.Post, new { @class = "deleteForm" }))
...
To send pdf files (or any other file type) to the browser, I've seen examples that use the FileResult class or a custom Action Result.
Is there an advantage of using one over the other? Thanks
...
I deployed an asp.net mvc application and everything worked except for my Gallery page that streams pictures using flickr api. I get the following error.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact ...
I have a asp.net mvc view which is strongly typed view and i have a controller which returns
the ilist user based on the id provided. I am getting the following above error:
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[Data.User]', but this dictionary requires a model item of type 'Data.User'...
I'm trying to build a custom HTML helper for MVC.NET that would allow me to render object entities (Model Objects) as HTML forms. So I decided to do it using custom attributes such as html input type, readonly flag, css classes, etc. Similar in a way to LINQ Mapping attributes that set database related bindings for Table and Column. So I...
Hi I am writing unit tests for fluent Nhibernate, when I run the test in isloation it passes, but when I run multiple tests. or run the test more than once it starts failing with the message below System.ApplicationException : For property 'Id' expected '1' of type 'System.Int32' but got '2' of type 'System.Int32'
[TextFixture] public v...
I'm in the process of developing an ASP.NET MVC project, and after several weeks of research, I have a pretty good framework in place using StructureMap to register my dependencies at bootstrap time, create my controllers with the correct implementations, a custom model binder for passing data to my controller, etc.
After thinking about...
Long story short, I'm trying to add a few extra items to ViewData to make my life easier, and its an edge case that doesn't really justify its own model just for this one case. Keep reading for more specific details.
So I have a strongly typed edit view for one of my objects, everything works great until I try to put a dropdownlist on t...
how to create a asp.net mvc form helper that takes virtual directory into consideration?
In testing our dev server has:
http://devserver1/some_virt_directory/
production is:
http://www.example.com
I need the form post url to reflect if we have a virtual directory or not, is this possible?
...
I can't find anyone doing this, and I'm trying to get my head around the best way to tackle this issue.
I'd like to take the standard "List View" view in an ASP.NET MVC application, and convert all of the "Labels" to "TextBoxes" and then save any changes made to each record.
The end result would function very similar to the List View i...