asp.net-mvc

How to RedirectToAction from within an ActionFilterAttribute?

whats the best way to do a redirect (preferably a redirect to action) from within an ActionFilterAttribute? I want to be able to pass data into the controller action from within the ActionFilterAttribute as well. ...

Post IDictionary Back to MVC Model...

I am fairly new to MVC so please don't hesitate to suggest a better/cleaner/simpler way of achieving what I am trying to do in a more "MVC" friendly fashion. Here goes... To make this easier I will use a concrete example using movies and genres. A genre can be associated with many movies. Genres can increase over time and so can movi...

Help designing a order manager class

So I have an order manager class that looks like: public class OrderManager { private IDBFactory _dbFactory; private Order _order; public OrderManager(IDBFactory dbFactory) { _dbFactory = dbFactory; } public void Calculate() { _order.SubTotal _order.ShippingTotal ...

How do I use my Session variable in an if statement as an integer?

I have a Session that stores an int. I usually do the following... if(Session["test"] == null) Now that I am comparing... public ActionResult NumbersGame(int myNum) { if(Session["test"] != myNum)... How do I do that? ...

Is this basically what an IOC like NInject does?

Normally I would do this: public class DBFactory { public UserDAO GetUserDao() { return new UserDao(); } } Where UserDao being the concrete implementation of IUserDao. So now my code will be littered with: DBFactory factory = new DBFactory(); IUserDao userDao = factory.GetUserDao(); Use...

ASP.NET MVC - Generate Routes Without Http/Request Context

I'd like to be able to generate URLs from a RouteCollection without having access to the HttpContext. Looking at the way RouteCollection is implemented, all methods require access to a RequestContext in order to get the virtual path. I've worked around this by mocking the HttpContext but this adds an awkward dependency on RhinoMocks an...

Injection question when using Ninject 2 in ASP.NET MVC application

I'm using Ninject 2 with an ASP.NET MVC web app. All the dependencies are handled properly down the stack (Controllers->Services->Repositories). However I have some classes in the Services project that aren't in that "chain" that I also want to inject when the app starts. How do I get Ninject to recognize them? I have public properties w...

ASP.NET MVC+ multilingual page

Hello, I'm developing a website using ASP.NET MVC. The website should handle multiple languages. I would like to ask what are the best practices of handling multiple languagues - both for "static" texts and taken from DB. I read some threads about this on stackoverflow but i'm not sure how can I implement in when data from DB are recei...

select and deselect all checkboxes

<script type="text/javascript"> $(document).ready(function() { $("#paradigm_all").click(function() { var checked_status = this.checked; $("input[@name=paradigm]").each(function() { this.checked = checked_status; }); }); }); </script> <table class="data-table"> <tr> <th> ...

Troubleshooting an MVC deployment

I don't seem to have much luck with deploying MVC applications to my remote host. I've just built an updated site in MVC v2 using Visual Studio 2010 and, having published and deployed it via FTP to my host, it's not working. Source Error: Line 39: <compilation> Line 40: <assemblies> Line 41: <add assembly="System.Web.Mv...

ASP.Net MVC Error Validation

I have an error validation issue with an int. I have validation for a customer name: if (String.IsNullOrEmpty(CustomerName)) yield return new RuleViolation("Customer Name Required", "CustomerName"); now if I want to add validation for a city, in this case I have a CityID that gets saved as type int, so I can't write my i...

get responce from another server in mvc

In my mvc application i need to responce or return view value from another server. Like calling from one MVC application in a server to another mvc application in a server. ...

how to submit a form from one application to other

In my mvc application in need to submit the form from one application to another application. Is this possible? ...

How to automatically generate the site map path in page header?

I used web.sitemap to generate the site map path for my asp.net application. and I can generate two lays just like: http://localhost:8080/test.aspx but If i need to generate the MVC path like this: http://localhost:8080/test.aspx/edit/2 and I need to know the "2" to get the site map. Is there any method that I can use wild card http://lo...

Exporting a HTML Table to Excel from ASP.NET MVC

I am currently working with ASP.NET MVC and I have an action method that displays few reports in the view in table format. I have a requirement to export the same table to an Excel document at the click of a button in the View. How can this be achieved? How would you create your Action method for this? ...

How do I specify in an Ajax.Beginform accept-charset="gb2312"

I am trying to add an ajax form to my application. The problem is that I want to pass my input as gb2312 encoded. However I wasn't able to do new {accept-charset="gb2312"} as msdn suggested. I guess it's because the "-" in "accept-charset" breaks the CSharp variable naming rule. I tried to add an "@" in front of "accept-charset" but ...

post any checked chekbox

i updated code and this is the corect solution of problem [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(int[] rb, int id) { List<nastava_prisustvo> nastava = new List<nastava_prisustvo>(); string poruka = ""; for (int i = 1; i <=rb.Length; i++) { string name ...

Application in ASP.NET MVC 2 Beta running on IIS 7.5

Hi, i have problems runnning an mvc2beta application in iis 7.5. WebServer: Windows Server 2008 R2 (x64) Application: MVC 2 Beta (developted in Visual Studio 2010 Beta) On IIS i added a new application beneath the Default Web Site and the new application has Application Pool ASP.NET V4.0 If i runn application within Visual Studio ev...

What is the difference between ${...} and !{...} in the Spark View Engine?

What is the difference between ${...} and !{...} in the Spark View Engine? There probably is a really distinct difference between the two, but I see them used interchangeably. Does one encode the output and the other doesn't? Which I have seen some discussion about in the groups? If that is true then what does this do: ${H(Model.N...

ASP.NET w/ Restful Routes: Accessing a (sub)controller from within a resource

I'm not really sure how to express this, but one pattern I often see in RoR apps is something like this: /Post/postid/Comment/commentid or /Project/projectid/Tasks/taskid Essentially in the model since a Project has Tasks you can access the TaskController from within a project resource. Now I have started using the SimplyRestfulRout...