asp.net-mvc

ASP.NET MVC 2 user input to SQL 2008 Database problems

After my publish in VS2010 the entire website loads and pulls data from the database perfectly. I can even create new users through the site with the correct key code, given out to who needs access. I have two connection strings in my web.config file The first: <add xdt:Transform="SetAttributes" xdt:Locator="Match(name)" name="EveMod...

How do I get Asp.net MVC BeginForm to add closing tag correctly?

I seem to be missing something obvious here, but cannot see what it is. My problem is that the closing form tag for BeginForm is not being added to my markup. I am looping through a collection and creating a form for each item, but the forms arent closing properly. Any suggestions please? Thanks <% foreach (var item in Model) { %> <...

JQuery. Why can't I insert an html img tag in a textarea?

TextArea looks like: <textarea id="MessageContent" name="MessageContent"></textarea> JQuery looks like: $("#insert").live("click", function () { var t = "<img width='" + result.width + "' height='" + result.height + "' alt='" + result.descr + "' src='/Images/" + result.message + "' />"; $("#MessageContent")...

Switched to windows authentication in MVC and screen goes blank!

hi there Have switched to windows authentication in the debug mode, set NLTM in the project options but when i press play it just gives me a blank screen! Any ideas what I can do now? thanks! ...

Detect whether or not a specific attribute was valid on the model

Having created my own validation attribute deriving from System.ComponentModel.DataAnnotations.ValidationAttribute, I wish to be able to detect from my controller, whether or not that specific attribute was valid on the model. My setup: public class MyModel { [Required] [CustomValidation] [SomeOtherValidation] public st...

How to get parameters out of an ascx back to the main aspx page

I've got an aspx page that renders an ascx page with filtering capabilities. Inside the ascx page, parameters are passed as follows: <tr> <td class="label">Plataforma</td> <td class="field lookup"><%= Html.Lookup("s.Site", null, Url, "Sites") %></td> </tr> <tr> <td class="label">Data</td> <td class="field date"><%= Html....

Display Friendly Date, Numbers

Possible Duplicate: How do I calculate relative time? I am searching for a custom control for asp.net, which helps display user friendly dates, like instead of article date: (2-april-2010) it displays (2 months old) I am unable to find it on google, please can any one suggest links, custom controls, articles for the same. ...

Maintaining the query string in ASP.Net MVC

Hi all Just beginning my journey in ASP.Net MVC and I have a query about something before I dig myself in too deep. I have a table, which is paged, and I have 2 controls above the table: Dropdown that defines order of the results and apply button next to it Textbox that defines a filter and apply button next to it What I need to ac...

Should I go for ASP.Net MVC?

HI, I want to create an application which requires SQL reports. By SQL Reports I mean using report viewer to show sql reports. I am new to MVC and my idea about MVC is that, dont use Server controls. Should I opt for ASP.Net MVC for this application? ...

"this" in function parameter

Looking at some code examples for HtmlHelpers, and I see declarations that look like: public static string HelperName(this HtmlHelper htmlHelper, ...more regular params ) I can't remember seeing this type of construct any where else - can someone explain the purpose of the "this"? I thought that by declaring something public static m...

Faling to connect to Database due to database in recovery

I am using SQL Server 2008, developer edition. I connect to my database from my asp.net mvc application using Linq2SQL. I noticed that my database went into recovery mode about 4 times in a span of a month. I am running a few complext Linq2SQL queries. When database is in recovery mode, my asp.net mvc application is going off line as it ...

Partial view postback from a standard Html form with MVC

I have a file upload button on my MVC view. After the file is uploaded, my FileList partial view on the page should refresh. I tried to upload with Ajax.BeginForm(), but have discovered that Ajax will not submit file data. I've got the file upload working now by using the jQuery Form plugin, which lets you ajaxify the normal Html.Begi...

Using a .NET MVC Controller Action as the Source for an HTML <img>

I'm trying to display the picture associated with a user in my database (the picture field's data type is image) on a page - unfortunately the code below fails to do that. HTML <img src="/User/Picture/1" /> Controller Action public byte[] Picture(int id){ UserRepository r = new UserRepository(); return r.Single(id).logo.ToAr...

ASP.NET MVC: How do I validate a model wrapped in a ViewModel?

For the login page of my website I would like to list the latest news for my site and also display a few fields to let the user log in. So I figured I should make a login view model - I call this LoginVM. LoginVM contains a Login model for the login fields and a List<NewsItem> for the news listing. This is the Login model: public clas...

How do I save data without using sessions for postback in MVC?

I have 2 texboxes and 1 needs validation. I have this setup with Html.ValidationSummary display. I would like to keep the data that has been entered on the validation post. Instead the page is refreshed and the data is lost which makes the user enter the data again. How do I prevent that without using sessions? ...

I am passing a Controller as a parameter, can't get to RedirectToAction method?

My method looks like: public static RedirectToResult(Controller controller, ...) { } when I do: controller. I don't see RedirectToAction, how come? I get RedirectToAction from within the controller's action, but not when I pass the controller as a parameter to another classes method. Why? really confused! ...

Html.DropDownListFor not behaving as expected ASP.net MVC

Hello, I am new to ASP.net MVC and I am having trouble getting dropdown lists to work correctly. I have a strongly typed view that is attempting to use a Html.DropDownListFor as follows: <%=Html.DropDownListFor(Function(model) model.Arrdep, Model.ArrdepOptions)%> I am populating the list with a property in my model as follows: Publi...

How can I debug my MVC application together with MVC contrib project downloaded from codeplex

I want my MVC application to be step into MVC framework contrib project also when debugging.I have installed visual studio 2010 professional edition. ...

How MVC (ASP.NET MVC) band 3-tier architecture can work together?

I am writing a design document and people on my team are willing to do the move from ASP.NET WebForm to ASP.NET MVC. This is great, but I have a hard time to understand how MVC workswith in a 3-tier (Data Layer, Business Layer and Presentation Layer) architecture. Can we say that the Model, View and Controller are part of the Presentati...

Best way to sign data in web form with user certificate

We have a C# web app where users will connect using a digital certificate stored in their browsers. From the examples that we have seen, verifying their identity will be easy once we enable SSL, as we can access the fields in the certificate, using Request.ClientCertificate, to check the user's name. We have also been requested, howev...