asp.net-mvc-2

ASP.Net How do I get the base URL without HttpRequest?

I am trying to get the base URL from the worker role. I can't get it from there. How do I get the base URL in this situation? I have found this property: Application.Current.Host.Source but, in order for this to work, I need the reference System.Windows.dll which is in the Silverlight folder. Since I am not using Silverlight for thi...

ASP.NET MVC Exceptions not routing properly to Customerrors default route

I'm having an issue with exceptions showing app as stack traces in the page. I thought that I had mitigated this by adding this to the web.config: <customErrors mode="On" defaultRedirect="~/error/GenericError"> <error statusCode="403" redirect="~/error/NoAccess" /> <error statusCode="404" redirect="~/error/NotFo...

ASP.NET MVC IF condition in View

I have a action result method in the conrtoller which returns a IList to my view. Now the Ilist returns set of rows from database. some of the columns in there are bit values. Now when i am displaying those rows , the bit values are being displayed as true and false. I need to check in a IF condition if the value is true then display Ye...

While using silverlight, is there a way to use a button to change the webpage?

I have an ASP.MVC application which has a silverlight app inside. I want to change the page when I click one of my buttons. Is there a way to make it? ...

Generating entity class files from table schema

I am using LINQ to SQL with C#. Is there a method through which we can generate entity class files from the table schema? By dragging tables onto the graphical designer classes are generated but they are not the real class files(i mean actual files with the extension cs). I am aware of that we can code the class files first and then cr...

How can I put a Silverlight Application into a ASP MVC view page?

I'm working with both silverlight and asp mvc. The silverlight application performs a page request, and it works fine (into the test page generated by the VS), but I can't find a way to put it into my view. MiniSIG <div id="silverlightControlHost"> <object data="data:application/x-silverlight-2," type="application/x-silverl...

ASP.NET MVC 2 Futures documentation

Is there any documentation for ASP.NET MVC 2 Futures? ...

How to implement badges?

I've given some thought to implementing badges (just like the badges here on Stack Overflow) and think it would be difficult without Windows services, but I'd like to avoid that if possible. I came up with a plan to implement some examples: Audobiographer: Check if all fields in the profile is filled out. Commentor: When making a comm...

LINQ to SQL not updating database records in MVC 2 application

Hello :) Using MVC 2 I have been trying to make this record store project. Creating records work but updating them doesn't. No exceptions are thrown either. I examined getchangeset() right before submitchanges() it shows all zeros. Thanks for your reading and you help :) The Edit view: <% using (Html.BeginForm("Edit", "Song")) { %> ...

assembly problem asp.net mvc / mvc contrib

I am using the s#arp framework and want to use the latest mvc contrib. This means that I have to use asp.net mvc 2.0. So I refrenced the latest 2.0 dll for mvc 2.0 and the latest mvc contrib dll but still get this error: Error 1 Assembly 'MvcContrib, Version=2.0.36.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Versi...

Return int from MVC Action with Ajax.BeginForm

Whats the simplest way of just returning an int from an Ajax MVC Action call? I am currently trying: public ContentResult Create(MyModel model) { return Content("1"); } using (Ajax.BeginForm("Create", new AjaxOptions { OnComplete = "function(data) { alert(data); }" })) I get alert [object Object]. How...

How to display an explicit message with Html.LabelFor() as merely the name of the model's property

Hello, With ASP.NET MVC 1.0, we could write something like: <label for = "FirstName">First Name:</label> Which displays "First Name:" on screen. Now, with ASP.NET MVC 2.0, we have <% = Html.LabelFor(model => model>FirstName)%> Which displays "FirstName" on the screen. It looks to me a little odd to display things like FirstName, L...

How do I implement wizard type page navigation in an ASP.NET MVC 2 application?

I am using ASP.NET MVC 2 & .Net 3.5 with Visual Studio 2008. Ok, what I am referring to by 'Wizard type page navigation', is a site where you have a list of stages in a given process or workflow. There is some kind of visual denotation to indicate which part of the stage you are at. I have already implemented this part (albeit, it smell...

Best ASP.NET MVC practice to distinguish GET/POST action methods with same signature?

When implementing Edit action, I add two methods for Get and Post: Edit(string id) Ideally, they need have same signature. But of course this is not compilable. So I add a dummy parameter to HttpPost method (form in my case): [HttpGet] public ActionResult Edit(string id) { var user = Entities.Users.SingleOrDefault(s => s.UserID == ...

ASP.Net MVC - Refresh table data every 5 seconds

I am in the design stage at the moment and was wondering how I would update a table every 5 seconds. My table will display read-only data returned from my model. Normally my view would just have <table></table> HTML and then a foreach loop to write out the data. However because I want to refresh this whole table every 5 seconds I am u...

Asp.net MVC validation for non-strings

I originally built my site in MVC 1.0 using the NerdDinner tutorial as a basic outline. Many of the early design decisions were made simply b/c "that's how NerdDinner did it" Since then, it has really grown and was converted to 2.0. My validation still works the way NerdDinner did it and is very minimal, so although I've read about ot...

asp.net mvc html.dropdownlist error

CS1928: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'DropDownList' and the best extension method overload 'System.Web.Mvc.Html.SelectExtensions.DropDownList(System.Web.Mvc.HtmlHelper, string, string)' has some invalid arguments I am getting the user roles form the memebership provider and then asking the user to selec...

Where can I find the ASP.Net MVC2 combo box?

I can't find it in the toolbox anywhere. What control do I have available that is similar to a Windows Forms combo box? ...

Control of type 'ImageButton' must be placed inside a form tag with runat=server. I thought MVC didn't use this?

I thought one of the benefits of using ASP.Net MVC2 was the cleaner and more logical markup you could make for a webpage. I'm creating the design of my master page and when I try to run it I get this error: Control 'ctl00_ImageButton1' of type 'ImageButton' must be placed inside a form tag with runat=server. Here's the code: <body> ...

ASP.NET MVC2 Model/View/Controller Code

Hi all, can the code that supports the model, view and controller be located in a separate project? Thanks in advance. ...