asp.net-mvc

How can I retrieve element Id for Strolngly typed ASP.NET MVC HTML helper?

Hi In my View I'm using jquery ui datapicker. So I need initiate it with code like this $(function() { $('#elementID').datepicker({ }); }); In my View <%= Html.TextBoxFor(m=>m.StartDate) %> In old ASP.NET I may use tb_startDate.ClientID What is about retrieving element Id of Stro...

Tablesorter, Color rows depending on an specific value

Hi all, I've been looking around for a solution to this thing but I haven't found anything similar to what I want. I've got a table filled with data from a database, and I want to change the background colour of a specific row depending on the class I'm loading in each row. I have to display some data but as the fields to be display...

Membership and asp.net MVC

I’m building a site that needs users created with different roles and permissions to access different areas of the site. I using mvc 2 but I can’t find much clear guidance on using the Membership tool with mvc to create accounts and roles etc. I tried the web configuration tool which works but I would like to administrate the site remo...

Asp net MVC controllers and widgets

As I understand it, in ASP.NET MVC a httprequest is mapped to a controller/action. As one request is used to get one web page, could we call to these controllers "page controllers"? My other question is about widgets (user controls) and RenderPartial method: If a widget represents a classic ASP.NET webcontrol or usercontrol, and I ...

Handling a button click in MVC, why is there a string parameter?

I'm following this awful textbook, going through the basics of create/edit/delete records. The delete bit has a confirm button, and it is handled like so: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Delete(int id, string confirmButton) { It offers no explanation of why the button is passed as a string or how MVC interprets it. ...

Asp.Net MVC Tutorial Unit Tests

I am working through Steve Sanderson's book Pro ASP.NET MVC Framework and I having some issues with two unit tests which produce errors. In the example below it tests the CheckOut ViewResult: [AcceptVerbs(HttpVerbs.Post)] public ViewResult CheckOut(Cart cart, FormCollection form) { // Empty carts can't be checked out i...

Custom Model binder not firing

This is my custom model binder. I have my breakpoint set at BindModel but does not get fired with this controller action: public ActionResult Create(TabGroup tabGroup) ... public class BaseContentObjectCommonPropertiesBinder : DefaultModelBinder { public new object BindModel(ControllerContext controllerContext, ModelBindingContex...

Sharing a connection string

hi, I am developing a class library (C#) that i will use it for my different projects (later). My class library dll will use the connection string /data context of the project which will reference my new dll. How can i do it? Lets say i have a class Library Project named "CLP", and a website project "WP". I can add reference to CLP.dll f...

System.InvalidOperationException must contain value for ViewModel

Hello I have this in my controller: MyTestViewModel asdf = new MyTestViewModel { SomeTestDate = _b.GetSomeDate(SomeID).Value, SomeDate2 = SomeDate2.Value, SomeDate3 = SomeDate3.Value }; in the function "GetSomeDate" I have: var x = c.ExecuteScalar(); return x as DateTime?; And I get InvalidOperationException that...

Batch program to display files with complete directory

Hi, I want to store the URL of all files with same extension in specific directory to one Log file. IS there any batch command available for this. Exapmle I want to copy all files with *.TXT extension into one log file with its directory extension(URL) ...

Lost Session when AddModelError

Friends, I do not know why, but every time I add a ModelErrror my session is lost. Someone tell me how I can work around / fix it? Session[CtSessionName + SessionId] = _ListaAcaoMenuInfo; AcaoMenuInfoExt _SelecionadoAcaoMenuExt = _ListaAcaoMenuInfo.Where(p => p.Id_acao == id).FirstOrDefault(); ...

How to retrieve value from ViewData when the object is not a string?

Hello, Here's the functionality I'd like to exploit: I've a class myClass and would like to iterate over a collection that contains all the properties of that class. I'd like to send the index of that collection along with the other data so that I can control the each sequence of the iteration. Here's simplified versions of a Action m...

MVC Portable Areas not working with Typed views

When using MvcContrib Portable Areas I can't get the strongly typed views to work. I get the error message 'Could not load typeSystem.Web.Mvc.ViewPage<blah> I've tried with built in types to check if it's an error with my type. ...

MVC binding form data problem.

I am using an object that matches all the fields in my form. I then use the default binding to populate the object in my action, like this; public ActionResult GetDivisionData(DivisionObj FormData) My DivisionObj initializes all it's values to string.empty in the constructor. The problem is that when the binder populates the model f...

Problem with order by in LINQ

Hi, I'm passing from the controller an array generated by the next code: public ActionResult GetClasses(bool ajax, string kingdom) { int _kingdom = _taxon.getKingdom(kingdom); var query = (from c in vwAnimalsTaxon.All() orderby c.ClaName select new { t...

ASP.NET MVC - separating large app

I've been puzzled by what I consider a contradiction in terms: ASP.NET MVC claims to be furthering and supporting the "separation of concern" motto, which I find a great idea. However, it seems there's no way of separating out controllers, model or views into their own assembly, or separating areas into assemblies. With the fixed Cont...

Add custom Model Binders for derived objects and their base

My class diagram: BaseContentClass Page inherits BaseContentClass Tab inherits BaseContentClass ... If I do this ModelBinders.Binders.Add(typeof(BaseContentObject), new BaseContentObjectCommonPropertiesBinder()); then when in controller action parameter of type Tab appears, custom model binder is not fired. It gets fired if I d...

jquery plugin history not working on IE8

I am using the the jquery history plugin from http://www.mikage.to/jquery/jquery_history.html. I am not able to get the plugin to work on IE8. In Firefox it works as expected. IE8 works on the sample at the site of the plugin-creator. My site contains 3 links. I click entry 1 through 3 first. When entry 3 is shown I hit the back button...

MVC Pattern Clarification

Just I started learning MVC pattern, of course i am learning it from Microsoft's website.Just i want to gather quiz information from the experts. My understanding is (correct me then and there) 1 ) MVC does not support server side events, but supports client side events. If it supports client side events, I need html page with jQuery/J...

Passing parameters to telerik asp.net mvc grid

I have a telerik asp.net mvc grid which needs to be populated based on the search criteria the user enters in separate text boxes. The grid is using ajax method to load itself initially as well as do paging. How can one pass the search parameters to the grid so that it sends those parameters "every time" it calls the ajax method in res...