asp.net-mvc

Paging and routing in ASP.Net MVC

I am following Martijn Boland's 'Paging with ASP.NET MVC'. And while helpful it has raised a couple of issues I don't understand. Martijn says: Internally, the pager uses RouteTable.Routes.GetVirtualPath() to render the url’s so the page url’s can be configured via routing to create nice looking url’s like for example ‘/Ca...

How to create a custom html tag using the spark viewengine?

I've heard or read somewhere (can't recall where) that the spark view engine supports the notion of defining custom html tags. I would like to use this for rounded corners. Which in our HTML consist out of 6 different div's wrapped around the actual content. If I could replace this with or something like that it would make things much m...

jQuery Ajax call for buttons on a list

I have a list of data that i have in a view from an asp.net mvc application. It's a list of stock and I have two images (a plus and a minus) on the end of each row which will allow me to increase or decrease stock quantity. It works fine at present with a call to the mvc action but since the list is long I want to use jQuery and AJAX to ...

Can Dependency Injection delay creating objects required?

Hi folks, I'm playing around with some Dependency Injection (StructureMap) with my ASP.NET MVC application. Works great. Becuase StructureMap is using DI via the most gready constructor (I hope I got that concept named right), I'm under the impression that it creates an instance of an object for each argument, in the most gready constr...

add dynamic controls and get its values using jquery

I need to add dynamic controls and get its values in my asp.net mvc (C#) application using jquery. On click of button, i need to add specific dynamic controls, enter the values and pass its values on clicking submit button using jquery. For ex.: In Create Event of Google Calendar, we can add multiple options for reminder. Like that i n...

'Big' websites using ASP.NET MVC

Hi All, I suspect that this question may have been asked before, but I couldn't find it. I would like to know what the biggest sites out there using ASP.NET MVC at the moment are. StackOverflow, obviously - but I haven't heard about many others yet. Are there any other 'big' ones? Thanks ...

ASP.NET MVC open source application. MySQL or SQL Server?

Hi, I have around 4 years experience of ASP.NET & SQL Server (only web forms). I have a little knowledge of Ruby on Rails and have developed one very small 2-3 pages application in ASP.NET MVC in my job. Now I and one of my friend ( same experience like me) are willing to gain more experience of ASP.NET MVC. For that purpose we have thou...

How do I show error messages back to an ASP.NET MVC page?

Hi folks, Notice how StackOverflow displays some nice Status Bar message based on your activity? (That orange bar at the top page) I'm hoping to do the same but I'm not sure how. Now I know how to display validation errors to the UI using ASP.NET MVC 1.0 ... that's not too hard. But if i want to show a status bar thingy (not sure what...

can you query contact info from gmail programatically from csharp

i have a asp.net mvc webpage that queries a SQL server database for contact info. I have now migrated all of this contact info into gmail. is there anyway i can replace the model section of the asp.net mvc site to query my gmail contact info ? is there an example code to access this via some API? ...

Can't find my cookie when logged in

Hi On my web site (asp.net mvc), I use cookie to store search pattern. when I switch from login or not I get a new cookie , because the one created in the other 'environment' is not found. I'm testing on localhost so I don't know if the problem will persist when setting the domain. How come Logged in or not matters for cookies that ar...

asp.net-mvc ajax query on keypress rather than submit button

I am using Ajax.BeginForm to update data on a webpage (as per the code below). Is there anyway i can hit the backend server on every keypress instead of waiting for hitting the submit button this way, when i type "a", it will query on "a' and show all the db results then if i type "b" it will filter the list on "ab" and so forth . . ...

how do you organize your model code in asp.net-mvc?

it seems like in my model folder, all of my classes fits into one of 3 buckets: Pure POCO data objects / business Objects Repository implementation code to query databases and external services Helper code. Is this normal and is there a best practices on how to organize this. should i have subfolders for 1, 2 + 3? any recommendatio...

Add Group Membership to Custom Membership/Roles provider

Hi Being fairly new to the MVC Framework, I am trying to establish a custom Membership provider which can support the concept of Groups or departments. I need to assign each user to belong to one (and only one) of several groups - each group (and its members) can only view records which belong to it - identified by the GroupId. I need...

What is the equivalent of OnCreatingUser in Mvc and how to use it

In my Web forms applications I had been wiring my Asp.net membership register controls event "OnCreatingUser" to do my checks for whether the user name or email exits or if the user name is appropriate. What is the equivalent method in Mvc and how is it used? Here is part of my method from a web forms application. public void cuwRegis...

Dependency injection with Unity and ASP.NET MVC

Hey folks, I'm attempting to use Unity as my IoC container, which "kinda" works. Snip from global.asax: protected void Application_Start() { //... left out for clarity //setup dependency injection with Microsoft Unity DependencyInjection(); } private void DependencyInjection() { va...

Cannot implicitly convert type 'System.Linq.IQueryable<Project.Models.TaskTimeLine>' to 'Project.Models.TaskTimeLine'.

I'm trying to pass a custom shaped class to a view, but I'm having a little trouble. This is the error I'm getting. Cannot implicitly convert type 'System.Linq.IQueryable' to 'Project.Models.TaskTimeLine'. An explicit conversion exists (are you missing a cast?) This is the first time I've added a list to a class, and trying to pass on...

Cannot display text returned from a static function in asp.net

I'm following the tutorial located at: http://www.asp.net/learn/mvc/tutorial-20-cs.aspx I created my own .Menu() method to return a string of menu items. No matter what I do, I can't get my menu items to appear. If I set a breakpoint at the return of the .Menu() method and copy it's results to the correct location in Site.Master, ever...

how do radio buttons work with asp.net mvc binding

i have an strongly typed object that represents all of the textbox properties of a form and it works fine when i post to the controller. i now need to add a radio button to this form. how does that map to the strongly typed objects? ...

How do I set up log4net for Asp.NET MVC application

We have a fist MVC application and I am wandering what special considerations there. In the regular web forms applications we pretty much just wrap events on code behind pages with try catch blocks. But it seems less clear with mvc as far as helpers, controllers, routes, etc. Where should I make sure there is logging. ...

How can I get the name of the view in master page

Essentially, the question is in the title. I have a ASP.NET MVC application, and I need to get and use the name of the view in the master page. For example, I may want to include a "viewname".js in the header of every page or use it in RenderAction call. Of course, I can create asp:ContentPlaceHolder in the head section of master page,...