asp.net-mvc

How to protect HtmlHelper code in MVC controls

I am writing a custom mvc control (commercial), and all of the control's code lives in the custom htmlhelper code that i will have to distribute to the user. I am ok with this for my commercial license sale, but for evaluating the controls, if i give out the htmlhelper code locally for my potential customers to evaluate, the user can si...

Livevalidation clientside validation - can you control the position of the validation messages?

I'm using LiveValidaion for my clientside validation http://livevalidation.com/ and DataAnnotations for my validation rules. This all works fine except that the clientside error messages are only ever displayed to the right of the element being validated. Is it possible to move this validation message below the element being validated?...

MvcBuildViews true with Entity Framework in ASP.NET MVC 2

Hi everybody, In VS 2010, changing true in a MVC2 project's .csproj file causes an error if you are using Entity Framework. Could not load type 'System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider'. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config 129 I want to build views while I'm debugging, and I also want m...

ASP.NET MVC 2 InputExtensions different on server than local machine

Hi everyone, So this is kind of a crazy problem to me, but I've had no luck Googling it. I have an ASP.NET MVC 2 application (under .NET 4.0) running locally just fine. When I upload it to my production server (under shared hosting) I get Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'T...

Custom model in ASP.NET MVC controller: Custom display message for Date DataType

Hi I have an ASP.NET MVC Page that i have to display the fields in customized Text. For that I have built a CustomModel RequestViewModel with the following fields. Description, Event, UsageDate Corresponding to these my custom Model has the below code. So that, the DisplayName is displayed on the ASP.NET MVC View page. Now being ...

How to make dropdownlist show a selected value in asp.net mvc?

I have an edit page with a Html.DropDownList in it....I cant show the dropdownlist value it always shows up with Select instead i want to make the dropdown show an item as selected based on a model value say Model.Mes_Id... Any suggestion how it can be done... <p> <label for="MeasurementTypeId">MeasurementType:</label...

How to store user preferences? Cookie becomes bigger..

My application (Asp.Net MVC) has great interaction with the user interface (jQuery/js). For example, setting various searches charts, moving the gadgets on the screen and more .. I of course want to keep all data for each user. So that data will be available from any page in the Dumaine and the user will accepts his preferences. Now I k...

Create a strongly typed view which inherites a class which is concrete

Hello All: I am having one class called BaseClass which contains some logic applicable to whole web site. In order to create a strongly typed view we need to inherit the page from System.Web.Mvc.ViewPage generic class. But In our case I have to Inherit the BaseClass from System.Web.Mvc.ViewPage to apply some common settings, but the B...

whether this is a valid getJSON() in jquery?

I am using asp.net mvc with jquery... I have made a json call to a controller method and it returns json object [Object object] for me. I dont want that instead i want to get the json string... Any suggestion... $(document).ready(function() { $.getJSON('Materials/GetMaterials', null, function(data) { alert(data); ...

Paging using Linq-To-Sql based on two parameters in asp.net mvc...

As two parameters i say currentPage and pagesize .....I thus far used sql server stored procedures and implemented paging like this, GO ALTER PROCEDURE [dbo].[GetMaterialsInView] -- Add the parameters for the stored procedure here @CurrentPage INT, @PageSize INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result se...

What's the best practice to setup testing for ASP.Net MVC? What to use/process/etc?

hi there, i'm trying to learn how to properly setup testing for an ASP.Net MVC. and from what i've been reading here and there thus far, the definition of legacy code kind of piques my interests, where it mentions that legacy codes are any codes without unit tests. so i did my project in a hurry not having the time to properly setup un...

How should I organize my mvc templates?

Hi, In the new version of MVC we have been given display and editor templates. I was wondering how to make the best possible use of these. I was at first thinking in the line of creating one for a collection and one for an item in the case I want to display either as a list or single but it does not really make sense to me. I'll show yo...

Iterating throgh mvc model lists using javascript

I want to iterate through my model values. Following is what I did to achieve this. But the varible count never increments. How can I increment it to iterate throgh my model values? <script language="javascript" type="text/javascript"> function AddStudentName() { var StudentName = document.getElementById('txtS...

ASP.NET MVC2 Membership: How to get userID and roleID of logged user?

How can I get userID and roleID of user that is logged to application? User.Identity doesn't contain these details? Thanks, Ile ...

Insert problem with Oracle using Nhibernate

There is a CLOB field we are trying to insert html content and sometimes we are getting an error as: ORA-01461: can bind a LONG value only for insert into a LONG column When i used nhibernate profiler and copy the query to Toad, it asked me to enter values for variables called "NBSP"! Is this means that nhibernate doesnt escape spe...

Is this a valid jquery getJSON call?

I am using jquery getJSON with asp.net mvc controller... I cant able to get it work.... public JsonResult GetMaterials(int currentPage,int pageSize) { var materials = consRepository.FindAllMaterials().AsQueryable(); var results = new PagedList<MaterialsObj>(materials, currentPage-1, pageSize); return Json(results); } and ...

Image link in jqgrid column.

I want to display image link in a column in jqgrid with image name as querystring.The link should contain following path "Home\ShowImage?imageName=vlaue". ...

get count from Iqueryable<T> in linq-to-sql?

The following code doesn't seem to get the correct count..... var materials = consRepository.FindAllMaterials().AsQueryable(); int count = materials.Count(); Is it the way to do it.... Here is my repository which fetches records... public IQueryable<MaterialsObj> FindAllMaterials() { var materials = from m in db...

asp.net-mvc get a dictionary in post action or how to transform FormCollection into a dictionary

anybody knows how to transform the FormCollection into a IDictionary or how to get a IDictionary in the post action ? ...

Mapping to an ASMX service using routing in ASP.NET MVC

Hi there, I wonder if there's any way to map a URL to ASMX service much like it is done with pages (using routes.MapPageRoute() method). When I tried to do it simply by pointing the MapPageRoute to my service I get the error Type 'MvcApplication1.Services.EchoService' does not inherit from 'System.Web.UI.Page'. Matthias. ...