Questions tagged "asp.net-mvc" (page No.1)

MVC Entity Framework computed value that exists in database

I have used entity framework to generate models from my existing database and I want to compute the value for a property. e.g. I have a MetaInfo table: PageTitle, string, not nullable MetaTitle, string, nullable So I've constructed a partial class: public partial class MetaInfo { public string MetaTitle ...

mvc - allow asp tags in chtml pages

Is there anyway to allow asp tags in chtml MVC pages? Do I have to declare something in the view itself? I know its possible to have an aspx page in the solution, but I would like to combine controls in the chtml page. Example: @using (Html.BeginForm()) { <asp:calander>... etc ...

Server cannot append header after HTTP headers have been sent c# pdf inline

So I have been having this problem for a while now for trying to return a pdf inline response. I searched all through the help coding pages for answers to this and can not find something that works yet. I made a simplified example of what I am doing below. ...

How to programmatically set SlidingExpiration to true in mvc Application

I have an MVC 3 application with an authentification form. When the user checks the checkbox "remember me", the auth cookie must be set to 2 week, and when he doesn't it should be 30 minutes. In both cases the sliding expiration should be turned on. According to this ...

Setting Up MOQ Update Test

I am developing Moq tests for various entities. I can setup create and delete tests fine, but not update - the entity in the repository does not change. I know this is due to the PersistAll doing nothing (probably due to a setup I am missing). This is a sample of ...

Curious about MVC Controllers?

Just a quick question, when you create a new controller for a new MVC ASP.Net app how does it know which controller to use. More specifically, given you create a new controller and you call it SockController in order to use said controller I would navigate to http://mywebapp/sock. How did ...

MVC routing with a hybrid CMS and functional site

We are thinking of creating a new site in MVC. The issue is the current site this new one will be replacing has about 1,000 static content (html content in a master page asp.net webforms wrapper) and we would like to push all of that static content in to ...

LogOn Partial view not closing on authentication

This is my first attempt at trying to understand jquery/Ajax, thought i would try to build a log on partial view based on the ASP.NET MVC 3 template. My problem currently is right now the partial view loads up properly, but when i submit a user, a correct one, the partial ...

MVC Membership & Profile Strategy

Bear in mind, I have researched this and have found several articles, however, they are mostly old (like from 2008) so I am wanting more recent information pertaining to the latest version(s) of ASP.NET MVC. I am using the Membership built-in thing to provide user registration, login and roles. I want to ...

Calling an Action in MVC when redirected from a partial view

I'm having this issue in which I have a log in screen and a register screen in different cshtml files, but the register view is called as a @Html.Partial. The code in the log in screen is as follows: <div class="panelLogIn left @if ...

Stub Unit of Work and Repository

I implemented a UnitOfWork and Repository pattern as described here, where the UnitOfWork holds a reference to each of the repositories. I am adding unit test to my project and I want to create a stub UnitOfWork. The problem is I can't seem to get Rhino Mocks to ...

Decrypt Serialized object

In the below code I am reading an object in memory and serializing it then encrypting it. But when i try to derypt it gives me an error "system.security.cryptography.cryptographicexception length of the data to decrypt is invalid" Dim memoryStreamLength As Integer = 0 Dim crypt As TestCryptography = New TestCryptography(TestCryptography.SymmProvEnum.RC2) Using memoryStream ...

How do I scaffold when creating a Controller that represents more than 1 Entity?

I have Entity Framework modeling a legacy database that has about 30 tables. I am using ASP.NET MVC 4 and would love to use scaffolding based on an Entity in my EDM. I have seen a ton of examples on this but I am running into an issue. My needs ...

Create 2 objects by one controller/view

I want to create a user form to create a new Look (Look is table in my DB). That's easy and I know how to do that. But my every Look object have his Category and how to build form where when creating Look I can also create a Category ...

closeAfterEdit not working after editing the form jqGrid

I am using jqgrid and the only issue is Edit form is not closed after editing, whereas Add form and Delete form are closed and reloaded properly. I think I am giving the options order incorrectly but I tried different permutations but no luck. Can anyone give a look at ...

asp.net entity framework keys in response

i am trying to write my first RESTful api in c# using asp.net web api and entity framework my issue is that the list that returns from my entity framework query is polluted with entity key information that is useless (i found out that because my columns are nullable, ef thinks ...

Pattern matching on TextBoxFor misbehaves in Firefox

You can see a live example of my little ASP.NET MVC3/Razor app here. The text boxes and textareas all have the following attribute to require just word characters. The form uses jquery-validate.js. pattern = @"\w{1,50}" //50 characters, etc. In Firefox only (v13.0.1) these fields are getting highlighted as if they are ...

ASP.NET C# MVC - Capturing value of item in foreach & passing to modal

This may end up being a much simpler problem than I'm making it out to be, but here goes... I have a BookManager class and a Book class. BookManager has many Books - this is setup through EntityFramework using CodeFirst. In the Details page of BookManager, I'm using a foreach statement ...

« Previous12345678910 ... 19781979Next »Show All