asp.net-mvc

Output text with hyperlinks

If you have text coming from a database such as: "New Apple TV Offers 8 GB of Internal Storage, 256 MB RAM http://t.co/fQ7rquF" Is there a helper method that takes that text and wraps the web address as a anchor tag? ...

asp.net mvc setting XElement xml to empty

How can I do something like XElement xml =empty; ...

Asp.Net MVC 2 Dropdown Displaying System.Web.MVC.SelectListItem

I have a table that contains a list of EquipmentIDs and another table that has maintenance records. When the user edits a maintenance record I want there to be a drop down list of all of the equipment IDs from the table. The dropdown list populates, and it populates with the correct amount of entries, however they all say "System.Web...

jQuery passing params to MVC Controller. Why are my params empty?

I'm converting a Web Forms app to MVC. I have a js method that calls a Controller action method (below) function GetUsers(pageNum) { var sortTh = $('thead .sort', document.getElementById('usersTable')); var sortCol = sortTh.find('a').attr('rel'); // { } is declarative shorthand for new Object(). var userRequest = {}; userRequ...

Stop site reusing session id on expiry

Hi people. I want to be able to log when a user ends their session on our application and record whether it was a sign out or a the session expired. I am using cookies.Add(new HttpCookie("ASP.NET_SessionId", "")); to set a new sessionId on sign out, but when the session expires, the sessionId is reused if the browser instance is no...

ASP.NET MVC - compression + caching

I've seen a number of options for adding GZIP/DEFLATE compression to ASP.Net MVC output, but they all seem to apply the compression on-the-fly.. thus do not take advange of caching the compressed content. Any solutions for enabling caching of the compressed page output? Preferably in the code, so that the MVC code can check if the page...

search treeview help please

Hi All, given a hierarchical view on my asp.net mvc page is it possible to type in the search field and have the treeview dynamically filter out the tree as more letters are typed but leave the root nodes alone (like don't include north,south,east,or west)? Thanks, rod. [TextBox filter goes here] [treeview control below] /* I'm look...

Bestpractice DI with ASP.NET MVC and StructureMap - How to inject dependencies in an ActionResult

I edited my whole question, so do not wonder :) Well, I want to have an ActionResult that takes domain model data and some additional parameters, i.e page index and page size for paging a list. It decide itself if it returns a PartialViewResult or a ViewResult depending on the kind of web request (ajax request or not). The reffered dat...

Do something on Page Load in ASP.NET MVC

I have a dropdown on my homepage that I need to bind to a data source when the page loads. I have a basic controller for the page: public class HomeController : Controller { public ActionResult Index() { return View(); } } I'd like to do something like this on the view page: <select id="ddlCities"> <% foreach ...

BidSystem, online auction, problem with timing

Hi, guys! I'm developing an online auction with time limit. The ending time period is only for one opened auction. After logging into the site I show the time left for the open auction. The time is calculated in this way: EndDateTime = Date and Time of end of auction; DateTime.Now() = current Date and Time timeLeft= (EndDateTime -...

ASP.NET MVC -URL structure recommendations

Is there any standard for setting up URL (Controller) structure? I usually look at my entities and set up a Controller for each entity I need to expose. Is there any standard I am missing? Are there other choices? ...

Why is Visual Studio 2010 mixing up System.Web And System.Web.Abstractions?

Visual Studio 2010 seems to be mixing up the above mentioned libraries. This code sample is from the book "Pro ASP.NET MVC2 Framework" by Steven Sanderson. 01 [TestMethod] 02 public void HomePage_Recognizes_New_Visitor_And_Sets_Cookie() { 03 // Arrange: First prepare some mock context objects 04 var mockContext = new Mock<HttpConte...

What are the things to absolutely check when deploying an MVC 2 web application?

Hello, I am going to deploy my first MVC web application to the internet. As is the first app with this framework for me, I was wondering if I can collect some advices regarding what should be done to prevent troubles. I am generic on the question and this is xpressely done to collect the most various answers. Thanks! UPDATE: Thank...

ASP.Net MVC2 web app capable of plugins and themes architecture

I am wondering if ASP.Net MVC 2 is a good choice for my current project. I want to build a social site that will allow for plugins or modular apps to be added on to it. An example of what I am talking about would be socialengine.net or even Joomla. I was thinking that mvc areas would make good modular apps to plug into a core app but wo...

How to send Complex Data (object) from view to controller?

I'm trying to pass this Person Object from my view to controller without Form, how do I do that? Here's my attempt: VIEW <%=Html.ActionLink( "Jump", "Jump", new { name="MyName", person=ViewData["Person"]}, // lets assume ViewData["Person"] is not null null) %> CONTROLLER public ActionResult Jump(string name, Person per...

How to integrate Simply Hired XML API with C# code(ASP.NET MVC )

HI, Simply hired provides APIs for accessing job info programmatically. please have a look at the following URL. Simply Hired API call When i make a request with this URL. I get some thing like XML. But this doesnt begin with a XML tag . The SImply Hired API provider have also given the DTD to validate against. E.g Response from s...

calling javascript function for ajax.actionlink

I have the following ajax.actionlink. i want to add click event to this actionlink. How can i do that <%= Ajax.ActionLink("text", "textaction", new { param = 1}, new AjaxOptions { OnSuccess = "updatePlaceholder", ...

MARS in SQL Server 2000

Hello Friends, I am working in ASP.Net MVC 1.0 and SQL Server 2000 using Entity Framework. My faulty controller code is given below: int checkUser = id ?? 0; string userNameFromNew, userNameToNew; if (checkUser == 1) { userNameFromNew = "U" + Request.Form["usernameFrom"];...

Why doesn't my PDF document render/download in ASP.NET MVC2?

I have an ASP.NET MVC2 application in development and I am having problems rendering a .pdf file from our production server. On my Visual Studio 2010 integrated development server everything works fine, but after I publish the application to the production server, it breaks. It does not throw any exceptions or errors of any kind, it si...

Patterns and Practices. Service layer??

Hi all, Should I be doing my automapping in my service layer or at my controller? I like the Idea of Repository - Raw data IQueryable type stuff with full domain(type) objects. Service layer - Paged, Ordered, Filtered, Automapped View model to return Controller - Push the view with the correct model But having seen some nice stuff wi...