asp.net-mvc

Is there anyway to show a hidden div in the last row of a html table

i have an html table. here is a simplified version: <table> <tr> <td><div style="display: none;" class="remove0">Remove Me</div></td> </tr> <tr> <td><div style="display: none;" class="remove1">Remove Me</div></td> </tr> <tr> <td><div class="remove2">Remove Me</div></td> ...

Clone DB table row through MVC in SQL Server

Is there a simple solution for duplicating table rows in SQL Server as well as all table rows with foreign keys pointing to the cloned table row? I've got a "master" table and a bunch of "child" tables which have a foreign key into the ID of the master table. I need to not only create a perfect copy of the master table, but clone each an...

DotNetOpenAuth: Message signature was incorrect

I'm getting a "Message signature was incorrect" exception when trying to authenticate with MyOpenID and Yahoo. I'm using pretty much the ASP.NET MVC sample code that came with DotNetOpenAuth 3.4.2 public ActionResult Authenticate(string openid) { var openIdRelyingParty = new OpenIdRelyingParty(); var authenticationResponse = op...

How to check which action method rendered the current view (from within the current view) ?

Hello, I would like to know how to check which action displayed the current View (from the current view). For instance, to check if controller myController originated the rendering (I guess) I can write: <% if(ViewContext.Controller is myApplication.Controllers.myController)%> In fact, I want to use the same View model for 2 actions...

Cascading drop down list in asp.net mvc 2.0?

hello i want to implement cascading drop down list in asp.net mvc 2.0 from database. i had implementated it on mvc 1.0 but its not working in mvc 2.0 thank you. ...

request querystring from abstract controller

Hi I want all my pages to use have some viewdata. i need to get a client name from a querystring then based on that do some work and populate ViewData. my controller inherits from the controller created below. Request["client"] is giving System.NullReferenceException: Object reference not set to an instance of an object. public abstra...

prevent repopulating viewdata

Having populated a ViewData, is it possiblie to use that ViewData collection from multiple action methods within a controller without the need to repopulate it? ...

use viewdata to perform inline styles

Im populating viewdata with a bunch of css style properties. <span style="font-size:50pt; font-family:"<%= ViewData["font"]%>";"><%= ViewData["UserCopy"]%> </span> i want to be able to do something similar to the above. i.e use the style put into viewdata and use them on inline styles. how can i do this? thansk ...

How to set the option value through model

I need to have the value for the option in the following: I have created my select as follows: <select id="fromSelectBox" multiple="multiple" > <% foreach (var item in Model.Projects) { %> <option><%=Html.Encode(item.Text)%></option> <%} %> </select> How do I se...

How to map IEnumerable<SelectListItem> to IList<> for ListBox

I have two classes. Class1 and Class2. public class Class1{ ... public virtual IList<Class2> Class2s{get;set;} ... } public class Class2{ ... public virtual IList<Class1> Class1s{get;set;} ... } The view contains <%=Html.ListBox("Class2s", ViewData.Model.Class2s.Select( ...

How to pass data from view to UserControl in ASP.NET MVC?

Say I want to do the simplest of the data passing as follows : <% For i = 0 To 10%> <%Html.RenderPartial("MyUserControl")%> <% Next%> What I want to do is to pass the variable i as the parameter to the UserControl so that it displays the number inside a, say, bordered div. How is this possible? Thanks ...

Multiple custom model binders for one model in ASP.NET MVC

This is a general model binding question that applies to MVC 1 & 2. I'm wondering if MVC2 would be better for this, but here's my question: I have a fairly complex model: public interface IEvent public int Id public string Title public List<EventContact> Contacts public List<EventDatesLocations> DatesLocations public class Ev...

MVC actionlink posting List of complex type

I have an actionlink that on click im passing a List of objects to a controller action. Example: View: Html.ActionLink("TestLink", "TestMethod", "Test", Model.SampleList, null) TestController: public ActionResult TestMethod(List<SampleList> sampleList) { return View(sampleList); } When I do this I get a null sampleL...

TDD a controller with ASP.NET MVC 2, NUnit and Rhino Mocks

What would a simple unit test look like to confirm that a certain controller exists if I am using Rhino Mocks, NUnit and ASP.NET MVC 2? I'm trying to wrap my head around the concept of TDD, but I can't see to figure out how a simple test like "Controller XYZ Exists" would look. In addition, what would the unit test look like to test an...

Asp.net mvc - trying to display images pulled from db \

//Inherits="System.Web.Mvc.ViewPage<FilmFestWeb.Models.ListVideosViewModel>" <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>ListVideos</h2> <% foreach(BusinessObjects.Video vid in Model.VideoList){%> <div class="videoBox"> <%= Html.Encode(vid.Name) %> <img src="<%= ...

Syntax to specify Namespace when using helper.RouteUrl

I am using Asp.Net MVC 2 - RC w/ Areas. I am receiving an ambigious controller name exception due to having same controller name in two different areas. I've read Phil Haack's post Ambiguous Controller Names With Areas I can't figure out the syntax when trying to use UrlHelper (I have an extensions class). e.g. public static string ...

ASP.NET MVC authentication for iPhone application

This is for an ASP.NET MVC application. For browser based access on my normal controllers, I'm using standard forms authentication and auth cookies. My question is how I do the same for an iPhone application. I have a set of RESTful controllers that the iPhone application uses directly, but I'm not sure how to go about authentication....

Site Security/Access management for asp.net mvc application

I am trying to find a good pattern to use for user access validation. Basically on a webforms application I had a framework which used user roles to define access, ie, users were assigned into roles, and "pages" were granted access to a page. I had a table in the database with all the pages listed in it. Pages could have child pages t...

Has anyone implement RadioButtonListFor<T> for ASP.NET MVC?

There was an Html.RadioButtonList extension method in ASP.NET MVC Futures. Has anyone found a code for a strongly typed version RadioButtonListFor<T>. It would look like this in a view: <%= Html.RadioButtonListFor(model=>model.Item,Model.ItemList) %> ...

How do I setup ASP.NET MVC 2 with MySQL?

Is it possible to setup ASP.NET MVC 2 to work with a MySQL database? ...