asp.net-mvc

web framework that will reduce number of lines of code

which framework helps in reducing the number of lines of code needed to create a web app? ruby on rails? php? asp.net mvc? jsp/servlet? django/python? I just don't like typing a lot of code especially if it's boilerplate. If I can write 10 lines of code versus 100 to get the same results, I think most people would prefer 10...right? ...

RenderPartial from master page failing

I have a call to RenderPartial() from a master page that's returning empty on a remote server. Works fine on the local dev server. Any thoughts? ...

ASP.NET MVC View ReRenders Part of Itself

In all my years of .NET programming I have not run across a bug as weird as this one. I discovered the problem because some elements on the page were getting double-bound by jQuery. After some (ridiculous) debugging, I finally discovered that once the view is completely done rendering itself and all its children partial views, it goes ba...

ASP.NET MVC - creating and handling with URLs with Greater Than and Less Than characters

Consider a link to a page for a user's profile. A page is creating that URL like this: //Model.Name has value "<bad guy>" Html.ActionLink("foo, "ViewUser", new { id=5, title=Url.Encode(Model.Name) }) The actual outcome was http://mysite/Users/5/%253cbad%2guy%253e When navigating to that URL, the server generates a HTTP Error 400 - ...

Javascript double event firing

I am returning a simple javascriptResult that unhides a div. When I do this, other click events that post ajax will now post twice when clicked. What could be causing this? ...

Reverse function of HttpUtility.ParseQueryString

.Net's System.Web.HttpUtility class defines the following function to parse a query string into a NameValueCollection: public static NameValueCollection ParseQueryString(string query); Is there any function to do the reverse (i.e. to convert a NameValueCollection into a query string)? ...

can we call javascript function in c# code in Asp.net MVC view?

I want to get and pass the HTML element(a textbox) value as a query string to the Ajax.ActionLink(), is this possible? If yes, then please tell me how? Thanks in advance ...

How to make Multilingual Website in asp.net MVC?

I don't understand where to put the Resources and how can we take the value from that? ...

Is there Java counterpart for Aspnet 4's <%: %> XSS prevention?

I'm developer moving from C# to Java. Heard about new ASP net feature. <%: %>. It renders object with html encoding. Only these impolementing IHtmlString interface are not encoded (to prevent double encoding). See more in http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt-syntax-for-html-encoding-output-in-asp-net-4-and-asp-net...

How to Cache image when src is some action which returns image?

There are lots of questions about how to force the browser to cache or not to cache any image. But, I am facing slightly different situation. In several places of my web page, I am using following code for the images. <img title="<%= Html.Encode(Model.title)%>" src="<%= Url.Action(MVC.FrontEnd.Actions.RetrieveImage(Model.SystemId))%>...

dynamic grid style form that lets you update multiple rows in a single post in asp.net mvc

I'm starting out with MVC but not sure it's the best option. I need to create a form that is based upon a collection. Eg it might look like this: product Price Item 1 [textbox] Item 2 [textbox] [submit button] where "item" is pulled from the database and textbox allows users to update the price. essentially this is a type of datag...

DropDownList not working 100% in ASP.Net MVC

I am quite confused with how to effectively use the Html.DropDownList helper for ASP.NET MVC. Background: I have a 5-page form, which saves data to the form each time "Next" is clicked. Users may navigate back and forth between sections, so previous sections will already be pre-populated with previously-entered data. This works for Tex...

calling asp.net mvc action method using jquery post method expires the session

hi, i have a website where i provicde a link. On clicking the link a controller action method is called to generate a zip file after creation of zip file is done, i show the link to download the zip file by replacing the link to create a zip with the link to download the zip. the problem is that after zip file creation is over and link...

Calculate time of method execution and send to WCF service async

I need to implement time calculation for repository methods in my asp .net mvc project classes. The problem is that i need to send time calculation data to WCF Service which is time consuming. I think about threads which can help to cal WCF service asynchronously. But I have very little experience with it. Do I need to create new thread ...

Dyanamic client side validation

Is anyone doing dyanamic client validation and if so how are you doing it. I have a view where client side validation is enabled through jquery validator ( see below) <script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script> <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script> ...

view state in ASP.NET MVC Application

Hi, I have read that viewstate is not there in asp.net MVC application. I am doing model validation. Now if i have two text boxes on my page,and i am doing required filed validation for both of them in model. This validation is done on server side on click of a button. I will fill one text box and click on submit button. It does the va...

Validation is more sensible at which Level Views Level or Model level in asp.net MVC

Validation is more sensible at which Level Views Level or Model level in asp.net MVC & also link of good Tutorial on Validation in MVC ? ...

How can I pass parameters to the OnSuccess function of the AjaxOptions class in ASP.NET MVC?

How can I pass parameters to the OnSuccess function of the AjaxOptions class in ASP.NET MVC? Here's my code but it doesn't work: <%= Ajax.ActionLink("Delete", "Delete", "MyController", New With {.id = record.ID}, New AjaxOptions With ...

jquery split() and indexOf results in "Object doesn't support this property or method"

I have the following code: var selected = $('#hiddenField').val().split(","); ... if (selected.indexOf(id) > 0) { ... set value ... } I'm dynamically creating a CheckBoxList, and trying to remember the state of the checkboxes by putting the selected IDs into the hidden field. I get an error stating that "Object doesn't support thi...

How to specify HTTP expiration header? (ASP.NET MVC+IIS)

I am already using output caching in my ASP.NET MVC application. Page speed tells me to specify HTTP cache expiration for css and images in the response header. I know that the Response object contains some properties that control cache expiration. I know that these properties can be used to control HTTP caching for response that I am ...