asp.net-mvc

JSON and Backslash

Can anyone shed any light as to why my JSON is coming out below, with the extra backslashes. I am using ASP.net MVC to serialise a datatable, when I debug in Visual studio it all looks ok but when I look with firebug with adds the extra characters? Any ideas anyone? "[{\"uid\":\"516219026\",\"pic\":\"http://profile.ak.net/\",\"first_na...

why does the controllers action have HttpRequestBase, and the viewpage has HttpRequest?

My methods take HttpRequestBase as arguements, and I am finding it strange as to why the Actions in Controllers have access to HttpRequestBase but the view page's have HttpRequest. Is there a reason for this or just something that was not thought through? ...

What is the MVC program flow?

I am looking for a good description the the flow of events (life cycle) of what happens after I type in my application's url in the browser to when the page is actually displayed. Does anyone have one? Thanks. ...

Is there a way to include an email address "display name" in the smtp element of a Web.config file?

I'm working on an EmailSender, and I'm grabbing the email address from my Web.config file. I'd like to also grab a "display name" for that email, from the same section if possible, but I'm not seeing an obvious way to do this. In my Web.config file, I have included a default "from email address", like this: <configuration> <system.ne...

Why can I not call the DropDownList extensions methods from another extension method?

This extension method does not work on two separate development machines: public static string DdlTest(this HtmlHelper helper) { var si = new List<SelectListItem>(); si.Add(new SelectListItem() { Text = "1", Value = "1" }); si.Add(new SelectListItem() { Text = "2", Value = "2" }); return helper.DropDownList("test", si, n...

How to get just the URL of an Action in an ASP.NET MVC View?

I want to get the URL of a route using the same syntax as Html.ActionLink, but don't know how to do that from my View. Is there an HtmlHelper extension that works like ActionLink but returns only the URL? For instance, I want to write: <img src="<%= Html.ActionUrl("Image", new { id = 42 }) %>" /> ...

Proper way to handle thousands of calls to external service from asp.net (mvc)

Hi, I'm tasked to create a web application. I'm currently using c# & asp.net (mvc - but i doubt its relevant to the question) - am a rookie developer and somewhat new to .net. Part of the logic in the application im building is to make requests to an external smsgateway by means of hitting a particular url with a request - either as pa...

How can I add relationships to the aspnetdb database in MVC?

I'm having a hard time wrapping my head around how to use the Memberships in MVC. I know there is the built in ASPNETDB database which has all the basic tables for users and such. But what if I wanted to add a relationship between one of my custom tables and this built in user table? If I had a database table that contained blog comment...

append a parameter to querystring of existing url asp.net mvc

Im using asp.net mvc. c# How can i get the existing url (may have a bunch of querystring parameters on it) and then just append another parameter to the quesrystring. and make this a clickable hyperlink. ...

Entity Framework creating new record instead of modifying existing one

I'm using Entity Framework with an AS.NET MVC application. I need to allow the user to create new records and modify existing ones. I am able to fetch existing records no problem, but when I pass back in the edited entity and try to save it it creates a new one and saves it and leaves the original unmodified. I am getting the object fro...

asp.net mvc: checkbox onchange not working

I have a page with a set of checkbox's, that I want to run a javascript function on when there is a change (I have done something very similar with dropdown's - and that worked) However with the checkbox's I have three problems: my onChange event only runs "sometimes" (you have to change the focus between the different checkbox contro...

How to get last page visited in a controller

Hi, is there a way to get or store the last page visited? Example if I'm on a List Page with a New link that loads a page with form. If the user cancels, you go back to the previous page (List Page). Thanks ...

Running into an SQL Error with an MVC Application deployed on IIS

Hi, So I am new to working on web projects in general. I am working on an MVC application in Visual Studio 2008. I have generated an SQL database within VS, and I have deployed my application on IIS. However when I try to do anything in the application which will spark an SQL query, I get the following error: "Failed to generate a user...

MVC Html.DropDownList accessing the text field

Hi I'm having problem accessing the text field in a selected value of Html.DropdownList. My ViewModel is public class UserViewModel { public List<SelectListItem> SupportedCurrency { get; set; } public string DefaultCurrency { get; set; } } My controller populates the dr...

Why can't i add Bin Folder in an asp.net MVC web application?

I am developing a web application using asp.net MVC... RightClick->Add->Add ASP.Net folder-> there is no bin folder... I am using asp.net MVC 1.0 with visual studio 2008 sp1... Any suggestion... I find a bin folder in my root folder,but not in the solution explorer.. ...

Does ASP.Net MVC 2 validation need some more thought in terms of patterns and use?

Hey guys Here is the lay of the land. Like most people I have my domain object and I have my view models. I love the idea of using view models, as it allows for models to be created specifically for a given view context, without needing to alter my business objects. The problem I have is with type level validation defined on my domain...

Populate an Html.TextBox with a List of data that is converted to a String

<p> <label for="Tags">Tags:</label> <% String tagsText = ""; foreach (Tag item in Model.Tags) { tagsText += item.Name + " "; } %> <%= Html.TextBox("Tags", tagsText.Trim()) %> <%= Html.ValidationMessage("Tags", "*") %> </p> Obviously this code is not perfect, and I admit that. But how ...

How do I deal with the quantity column of a junction table using sql to entities

Hi I have 3 tables. Blog and Tag have a many to many relationship. BlogTag is a junction table with a quantity column. **Blog** BlogID Title **Tag** TagID Name **BlogTag** BlogID TagID Quantity I'm not sure how I handle the quantity column. I'd like it to store how many Blogs have a certain Tag Name How do I deal with the quantity...

render / call .aspx page html into another .aspx page

in my application, i have implemented ajax 4.0 client templates currently my templates resides on same .aspx page. (say Main.aspx) but i want to externalize them.(ie all the HTML would go on another page) for that i have used $.get() like $.get("/Module/getTemp/" + TemplateName, function(result) {... now, i want getTemp function i...

ASP.Net MVC: Creating an Area for json requests...

Hey guys Just wondering what people think about creating an area to hold/manage json based requests (note I am thinking mostly get data not post data). I know its not your typical use of an area (i.e. normally you would create a different area for blog vs forum) but I am getting to the point where my project isn't huge but I definitely...