asp.net-mvc

getting the request.files count as 0 in mvc

hello all, please help me when i am uploading a particu;ar file in mvc and i am requesting the file using request.files in the controller i am getting the count as 0 please tell me where i am missing.i am using asp.net + mvc. i have used a simple file upload control of html. please help me,its urgent Thanks Ritz ...

asp.net mvc IsAuthenticated attribute

is any solution to mark method like this [IsAuthenticated(true)] public ActionResult Profile() { return View(); } not call if (request.IsAuthenticated) ? ...

web ui controls and ASP.NET MVC

Why will not fill View page of this controller method public ActionResult Person() { testEntities6 testPersons = new testEntities6(); IQueryable<person> persons; DropDownLst.Items.Clear(); DropDownLst.Items.Add("proba"); persons = from i in testPersons.person select i; ...

Returning ActionResult in an AsyncController when an event ocurrs

I would like EndGetMatches in the code below to get called when a certain event is fired. BeginGetMatches executes and completes but I don't want EndGetMatches to get called yet. I want to return the ActionResult only when my other Thread notifies me i'm ready to. public delegate void MatchEvent(MatchEventArgs args); public IAsyncResult...

Adding Jquery functionality on PartialView load

How can I attach jquery on an ASP.NET MVC partial load. I've a form rendered in a partial that has some jquery attached, but that code is not running at all ...

asp.net mvc: why is Html.CheckBox generating an additional hidden input

I just noticed that Html.CheckBox("foo") generates 2 inputs instead of one, anybody knows why is this so ? <input id="foo" name="foo" type="checkbox" value="true" /> <input name="foo" type="hidden" value="false" /> ...

Render label for a field inside ASP.NET MVC 2 editor templates

I'm starting to use DataAnnotations in ASP.NET MVC and strongly typed template helpers. Now I have this in my views (Snippet is my custom type, Created is DateTime): <tr> <td><%= Html.LabelFor(f => Model.Snippet.Created) %>:</td> <td><%= Html.EditorFor(f => Model.Snippet.Created)%></td> </tr> The editor template for DateTime is...

jQuery - How can I override a background color animation with hover?

I am new to jQuery and need some help with the following problem. I have a simple table of data (20 rows by 4 columns) on a webpage (asp.net mvc). Note - I have built the table using <div> tags and not <table> <td> <tr> tags. For each row there is summary data and then the option to click 'Edit Record' on the right hand side of the row...

How to retrieve value from DropDownListFor html helper in ASP.NET MVC2?

Hello I know there was few similar questions here about DropDownListFor, but neither helped me... I use Entity Framework as ORM in my project. There's EF model called "Stete". Stete has Foreign on EF model called "Drustva" Now I'm trying to make a form for editing the data, for Stete model. I managed to display everything, including S...

How to mock Request.Files[] in MVC unit test class?

I want to test a controller method in MVC unit test. For my controller method to test, I require a Request.Files[] collection with length one. I want to mock Request.Files[] as I have used a file upload control on my view rendered by controller method. Can anyone please suggest how can I mock request.file collection in my unit test. th...

MVC 2 AntiForgeryToken - Why symmetric encryption + IPrinciple?

We recently updated our solution to MVC 2, and this has updated the way that the AntiForgeryToken works. Unfortunately this does not fit with our AJAX framework any more. The problem is that MVC 2 now uses symmetric encryption to encode some properties about the user, including the user's Name property (from IPrincipal). We are able to...

hidden form element not bound?

Is it standard/intended behaviour that the value of a hidden form field is not bound to the view model (nor is a query string value)? Example: <%= Html.Hidden("test", "13" )%> if my poco view model contains a property test it should be bound shouldn't it?! i have to set it explicitely in the controller at the moment which kind of def...

I want to export csv file that contains hebrew character in my ASP.net MVC application

I want to export csv file that contains hebrew character in my ASP.net MVC application I have tried many encoding but not work. Actually hebrew characters and not displaying as they are. Can anybody have idea? System.Text.UnicodeEncoding Enc = new UnicodeEncoding(); HttpContext.Current.Response.AddHeader("Content-Length", En...

How do I use a spark variable in an html helper?

Can I use a spark variable inside an html helper? Say we have <var url="Url.Action(“get”)" /> !{Html.Image("~/Content/up.png")} Now if I need to use the url inside Html.Image as an attribute(part of the 2nd param) to get <img src="~/Content/up.png" type="~/engine/get" /> how do I go about doing it? ...

ValidateRequest = False but in action it's still True and ignored that?

hi guy's, i want disable RequestValidation on particular view in ASP.NET MVC 2.0 RTM. so i added some necessary to view Page directive section as below: <%@ Page ValidateRequest="false" Language="C#" MasterPageFile="Path" Inherits="System.Web.Mvc.ViewPage<Path>" %> but RequestValidation isn't Disabled! i also added RequestValidation A...

Button with image and loading element id when clicked

Hello guys, I've made an application that makes full use of ajax, and what I need to do is: I want a button with a description + image that when clicked is disabled and instead of the original image in the button, appears the ajax loading element id inside the button. And when the ajax loading is complete, the original image of the butto...

Storing links to internal content pages in ASP.NET MVC

I'm using a route like this routes.MapRoute( "PageBySlug", RouteType.Regular, "{slug}", new {controller = "Page", action = "Display", slug = "Default"}, null ); to map request to ~/Some-Page-Slug to ~/Page/Display/Some-Page-Slug. When adding content, user can choose...

How do I submit disabled input in ASP.NET MVC?

How do I submit disabled input in ASP.NET MVC? ...

Retrieve Grid Id on CellEdit JqGrid

Hi guys, i was trying to do a Cell Editing based on this documentation http://www.trirand.com/jqgridwiki/doku.php?id=wiki:cell_editing I have two questions: How can i get the Index of my row posted to the server: The information i'm getting posted is the following: a) value of the cell b) RowId The thing is that the rowId doesn't h...

where to find a windsor controller factory for mvc 2 ? There is no mvccontrib.castle.dll anymore o_O

I was using WindsorControllerFactory from mvccontrib.castle lib until now, after i migrated to mvc 2 it doesn't work anymore, I've downloaded the latest mvccontrib release and no factories in there ...