asp.net-mvc

Conditional Attributes - Asp.Net MVC View

I have a requirement to add conditional disabled & class attributes to a dropdown form element. I have the following however it does not write out either of the attributes in any state. Is there a way around this. <%= Html.DropDownList("--Choose Make--", "models", ViewData["model_disabled"] == "false" ? new { @disabled = "disabled", @c...

How can generate views in asp.net-mvc unit tests?

Im trying to generate views in unit tests but i can't get around the missing VirtualPathProvider. Most viewengines use the VirtualPathProviderViewEngine base class that gets the provider from the current HostingEnvironment. protected VirtualPathProvider VirtualPathProvider { get { if (_vpp == null) { _vpp = Hosti...

asp.net mvc & popup dialogs

What do people recommend for creating popup's in ASP.Net MVC? I have used the ajax toolkit and component art's methods in the web forms world and am looking something with simillar capability. What JQUERY plugins do people like? SimpleModal, JBOX (I think this was what it was called) Is it worth exploring pulling out the javascript fr...

How do you set the width of an HTML Helper TextBox in ASP.NET MVC?

Some examples I found that apparently worked with older versions of mvc suggest that there was a length parameter of sorts: <%=Html.TextBox("test", 50)%> But that may have been mistakenly setting the value. How do this work in the current release? Passing in the style doesn't appear to have any effect. ...

Ideas for OpenSource CMS in ASP.NET MVC

I am in the process of collecting ideas for building an opensource CMS based on ASP.net framework. I have choosen ASP.NET MVC with Jquery as the tool to develop this. I have made this as community wiki. Background: Most of the good CMS that is available is built on PHP, though off late CMS built on ASP.net framework seems to be croppi...

MVC ASP.NET Best way to get 52 textbox key/values from View to Controller

I'm hoping that it isn't to pass each as a parameter to the controller post method.. Have a grid of 52 text boxes representing weeks in a year, each will be containing a decimal value, need ALL of these passed back to the controller for mass updating of the database.. edit: Adding more details. So my action Index(); returns a view wit...

Passing interface as a parameter to an extension method

I have used extension methods to extend html helpers to make an RSS repeater: public static string RSSRepeater(this HtmlHelper html, IEnumerable<IRSSable> rss) { string result=""; foreach (IRSSable item in rss) { result += "<item>" + item.GetRSSItem().InnerXml + "</item>"; } ...

binary .dat file

how can access the binary data file(.DAT). i am using geonames API. can anyone help me? ...

MVC ASP.NET Getting back my ViewData.Model in my View when I submit to a Controller

So I've return View(object);'d, and I press submit on that page, how do I get that object back in the controller? any ideas? my viewpage is public partial class Index : ViewPage<List<Models.Pricing>> and public ActionResult Index(int id, FormCollection datesForm, [Bind(Prefix="")]List<Pricing> model...

Does the ASP.NET MVC AjaxHelper deal with degradation?

Hi, Does anyone know if the AjaxHelper in the ASP.NET MVC framework deals with degradation? For example, if you have an ActionLink that updates the content of a div, if JavaScript unavailable, will the page do a full postback by renderubg the page (via an action on a controller) and call the action specified in the ActionLink? If not,...

ASP.NET MVC - View with master page, how to set title?

What is prefered way of setting html title (in head) for view when using master pages? One way is by using Page.Title in .aspx file, but that requires in master page which can mess with HTML code. So, lets assume no server side controls, only pure html. Any better ideas? UPDATE: I would like to set title in view NOT in the controller...

How do you use usercontrols in asp.net mvc that display an "island" of data?

I am trying to find out how to use usercontrols in asp.net mvc. I know how to add a usercontrol to a view and how to pass data to it. What I haven't been able to figure out is how do you do this without having to retrieve and pass the data in every single controller? For example, if I have a user control that displays the most recent ...

asp.net mvc RedirectToAction("Index") vs Index()

Say I have a controller with an Index Method and a Update Method. After the Update is done I want to redirect to Index(). Should I use return RedirectToAction("Index") or can I just call return Index()? Is there a difference? public ActionResult Index() { return View("Index", viewdata); } public ActionResult Update() { // do update...

Link security trimming in asp.net mvc

I would like to show some links only to authenticated users in an asp.net mvc web application. I use the template for an asp.net mvc web application in Visual Studio 2008 that came with the beta release of asp.net mvc. I use forms authentication. I would like to add something like the following to an existing view: <a href="/Account...

Reasoning behind ASP.NET MVC ActionResult being an abstract class?

In ASP.NET MVC, the ActionResult class, which is the base for all results returned by action methods from a controller, is defined as an abstract class with the single method ( Microsoft): public abstract void ExecuteResult(ControllerContext context); Can you think of any specific reasons for this design? Specifically, it seems a bit ...

FormsAuthentication after login

Ok, i have simple scenario: have two pages: login and welcome pages. im using FormsAuthentication with my own table that has four columns: ID, UserName, Password, FullName When pressed login im setting my username like: FormsAuthentication.SetAuthCookie(userName, rememberMe ?? false); on the welcome page i cant use: Page.User.Ident...

.NET OpenId Library - both Provider and Consumer

I would like to add OpenId support to an app. It runs on ASP.NET MVC, and I would like to have it support OpenId authentication for users, and also allow users to use the app as an OpenId Provider. So basically I am looking for a good library that can be used as a provider and consumer for OpenId, and it has to be easily plugged into ASP...

How to decide which is right, WebForms or MVC when doing ASP.NET

So I'm about to start of a small project for my sporting club for member registrations and I'm trying to decide between WebForms or MVC. Allit will be is a user login and data capture forms (or and data retrieval), so I was initally thinking WebForms with FBA but I've wanted to have a play with MVC for a while and I was thinking that it...

How do i pass a complex object to another View in ASP.NET MVC?

Hi folks, I'm trying to pass a complex object (that can be serialized, if that helps) to another view. Currently this is the code i have, in some controller method :- User user = New User { Name = "Fred, Email = "xxxx" }; return RedirectToAction("Foo", user); now, i have the following action in the same controller ... [AcceptVerbs(...

Azure and Microsoft ASP.NET MVC

I just got my azure invitation code...yay! Are there any official samples for windows azure + MS asp.net MVC? I still don't get the storage providers and services that come with Azure, it's a bit confusing. I don't think MS have done a very good of explaining it. ...