asp.net-mvc-2

Multimonth Calendar and Selected Dates Scenario with ASP.NET MVC ?

Hi, I am trying to demonstrate a web site scenario on my own. What i want to do is a multimonth calendar which can be filled with special days with a css class. I googled it and find some Js calander controls with customizable css.But i wanted to ask it first before i start coding and probably be wasting my time. Kind regards, Barbaro...

Entity framework 4, Dynamic query.

Is it possible to create a dynamic query with Entity Framework. I Have 18 tables, Each of them has the same structures. How can I create a dynamic query to reuse the same query for each tables. I would like to have a generic query for Create Read Update Delete. The read contains the same "Where" Clause. Thanks for your help. ...

MVC2 Action to handle multiple models.

I've been looking around for an answer to this, which I can't believe hasn't been asked before, but with no luck I'm attempting here. I have a signup form which differs slightly based upon what type of participant the requester is. While writing tests for the solution, I realized that all actions did the same things, so I'm attempting ...

Does an MVC 2 site with linqTOsql need repositories for each table object, or is there supposed to be one repository per site?

I've been working through a fantastic book (Pro ASP.net MVC 2 Framework, Steven Sanderson) and I am looking for clarification. In the book's e-commerce sample application uses linqTOsql and has just one table to hold product entries. Obviously, real world applications have many many tables. I am wondering if there is a separate reposit...

Eager Loading an indirectly related table

Hi folks Im new to MVC, EF4 and Linq, so forgive my ignorance If im using a Linq Query to return data to pop into a viewmodel, I can include tables with a relation and get to the data without relying on lazy loading. However I have a problem eager loading data that isnt in a directly relatede table. e.g I have fixtures that relate to ...

ASP.Net MVC File Upload Post Parameters

I am trying to go to a view with a speicifed batchId parameter wrapped in a ViewModel, pick a file to upload, get the uploaded file back and store the file data w/ the associated BatchId value in a database. When the form is submitted I don't know how to get back the viewmodel and the PostedFileBase so that I can get the BatchId value. ...

Help passing objects to methods in asp.net mvc 2

I have this snippet in my html... Fusion Charts requires I feed it an XML to create a graph <script type="text/javascript"> var myChart = new FusionCharts("/Content/Fusion_Charts/Charts/Column3D.swf", "myChartId", "470", "350", "0", "0"); myChart.setDataURL("/XML/Graph/?list=<%=Model.list%>"); myChart.render("Gra...

Download file of any type in Asp.Net MVC using FileResult?

I've had it suggested to me that I should use FileResult to allow users to download files from my Asp.Net MVC application. But the only examples of this I can find always has to do with image files (specifying content type image/jpeg). But what if I can't know the file type? I want users to be able to download pretty much any file from...

Build querystring for javascript?

How do I build a querystring for javascript with several parameters that I can pass along when calling an action method in MVC 2? This is what I tried: var queryString = "?fileName=" + file + "&filePath=" + filePath; document.location.href = '/Customers/Download/' + queryString; Action method signature: public ActionResult Download(s...

ASP MVC, Django or Rails?

I've to start my master thesis project and I've to choose a technology to work with. I've used Rails and ASP MVC, in two projects, but never used Django, only some play with it. But I've some experience with python and really like the admin interface. The objective of my master thesis is a creation of portal to a public hospital. I hav...

Add slashes in Area name on an ASP.NET MVC 2 route

Currently I have an Area in my ASP.NET MVC 2 project call 'API', which is self explanatory. As the API of my web application matures, I will soon need to add version numbers to my address. ie/ Instead of : http://site/API/ I will need http://site/API/1.0/ http://site/API/1.1/ ... What's the best practise to achieve this in ASP.NE...

MVC 2.0 Routes, redirect request, ignore request

IIS 7.5 MVC 2.0 ASP.NET 4.0 If my MVC site getting external request for any not existed files, e.g SomePage.aspx is there any ways to redirect such request to any controller/action. I am using elmah and it is throwing errors when such kind of requests coming. Also i did add routes.IgnoreRoute("SomePage.aspx") in global.asax.cs to ign...

How this controller can get the values it needs?

Say I have set up a url structure as follows (ASP.NET MVC2) http://localhost:XXXX/Product/ Click on link browse by color http://localhost:XXXX/Product/Color/ Click on link browse red color items by type (i.e. pen's) http://localhost:XXXX/Product/Color/Red/Pen In the controller, I will need to do a select based on these criteria. Ex...

Why mvc Html.HiddenFor does not render my field ?

I'm trying to do this simple thing <%= Html.HiddenFor(model => model.Id)%> the model is [HiddenInput(DisplayValue=true)] public int Id { get; set; } but i always get this rendered <input type="hidden" value="0" name="UserInfo.Id" id="UserInfo_Id"> i've check and the id is NOT 0.. ?! need some explanation here... Edit The pr...

Operator '+' cannot be applied to operands of type MvcHtmlString

I am converting an ASP.NET MVC application to ASP.NET MVC 2 4.0, and get this error: Operator '+' cannot be applied to operands of type 'System.Web.Mvc.MvcHtmlString' and 'System.Web.Mvc.MvcHtmlString' HTML = Html.InputExtensions.TextBox(helper, name, value, htmlAttributes) + Html.ValidationExtensions.ValidationMessage(help...

Cannot apply indexing with [] to an expression of type 'System.Web.Mvc.IValueProvider'

I am converting an ASP.NET MVC application to ASP.NET MVC 2, and I get the following error: Cannot apply indexing with [] to an expression of type 'System.Web.Mvc.IValueProvider' Here is the code: public static void AddRuleViolation(this ModelStateDictionary modelState, RuleViolation error, ...

What is the view: mean?

I've upgraded my MVC project and VS2008 to MVC2 and VS2010. When returning ActionResult for controller actions I notice the intellisense gives view: option. What is this about? ...

Error Redirect for Ajax Froms in asp.net mvc2

I'm building an asp.net mvc2 website and using a lot of ajax form elementes (Ajax.BeginForm to be exact) to asynchronously populate data on the page. I would like to redirect the user to the sign in page after x amount of time of inactivity on the site. When I do this currently, either through ActionExecutingContext, or HttpContext, the ...

ASP.Net MVC: Entity Selection in View without using dropdownlist

I have an EditTask View for editing the following properties for a Task that I am modeling. [Task Name] [Project Name] [Assigned Employee] Task Name and Project Name are just simple text boxes. I want Assigned Employee to be a selection from all the available Employee's currently in the database. Dropdownlist is not ...

mvc 2 help with xml partials

Ok, so in order to provide Data to Fusion Charts I need to give it some XML.. I have narrowed it down to this myChart.setDataXML("<%Html.RenderPartial("Graph", Model.graph_data); %>"); which renders myChart.setDataXML(" <chart caption='Grafico' xAxisName='Factores' yAxisName='Porcentaje' decimals='0' formatNumberScale='0' number...