asp.net-mvc

How to refresh grid after ajax call in asp.net mvc?

HI, I have a asp.net mvc grid with delete and edit button. when i click on delete button i need to delete the data and refresh the grid. for this i am making an ajax call which deletes the data, but not ablet o refresh the grid. How can i achieve this? ...

Combining MicrosoftMvcJQueryValidation and Ajax Submit

Hi all, I'm having troubles trying to apply MS JQuery Validation in my forms where I want to submit data via an Ajax call. I am using DataAnnotations and MicrosoftMvcJQueryValidation.js library to perform client-side and server-side validation. Server validation works great and I'm trying to enable Client validation by mean of <% Htm...

Tell Actions/Controllers to Persist TempData

I understand that TempData is designed to work only between a single page request. But I think have a situation I think breaks the intended functionality. I use Controllers in preference to Handlers for delivering images. I don't now if that is best practice, but it works very well for me. The problem though, is that each call to one of...

Handing forms in ViewUserControls

I am rendering out a ViewUserControl (.ascx file) in a view: <% Html.RenderPartial("Comments", Model.Comments); %> This ViewUserControl shows associated comments on an entry. I would like this control to render out a form as well, so users of my application can contribute. How would you add a form to a ViewUserControl and handle it's...

How can I do this ASP.NET MVC 1.0 code in MVC 2.0 ?

Hi folks, I'm converting one of our ASP.NET MVC application from 1.0 to 2.0. This is code that is erroring :- string virtualPath = HttpContext.Request.ServerName() + RouteTable.Routes.GetVirtualPath( new RequestContext(HttpContext, RouteTable.Routes.GetRouteData(HttpContext)), ExpressionHelper.GetRoute...

xVal client-side validation not working

I downloaded the xVal sample project from Steve Sanderson’s blog, run it, and the sever side validation it's working (after i click submit), but the client side doesn't; although i looked at the source and saw the generated javascript <script type="text/javascript">xVal.AttachValidator("booking", {"Fields":[{"FieldName":"ClientName","F...

With Compression ActionFilter, Server error messages clears content-encoding header and renders as gibberish

When I'm using a compression filter and get an error, the error page is just gibberish characters. The problem seems to be that when IIS transfers to the error page the compression filter is still in effect, but the headers are cleared. Without the "Content-encoding: gzip" header the browser just displays the raw gzipped binary data. I'...

replace form post method with jquery ajax method

I have a form within an ASP.NET MVC application and I'm trying to submit it via AJAX but whenever I replace my form submit with jquery like so: $('#formID').submit(function() { }); it still does the actual post back in the form itself instead of jquery taking over, am i doing something wrong? ...

Seek framework to implement a dashboard

Consider the term 'dashboard' as a generic UI pattern where multiple views stream different aspects of an site - new users, new orders, new questions, and so on. Essentially splitting a stream of log entries, each to its own viewport. Viewports might want to drill down to detail records or might want to hide itself until/unless wakened b...

Authentication Cookie

I'm writing a database authentication system for my web application which is wrriten in ASP.NET MVC. When someone authorize, it should save his username in cookies. Is it safe to just use HttpResponse.Cookies` for saving a cookie that its value is username? Wouldn't it forgeable? Saving only the username... Is it the right and safe way?...

How to integrate community server with a custom asp.net website?

Hi all, I am looking into community server for the first time in order to add social networking items to an existing website. So far most of the information I have found, including in the wrox books, is how to customise community server. I am having difficulty finding out how to program against it and specifically how to add it to a Web...

How to add variable to server-side binding

i have javascript code that looks like this: $('#lnkPopup').click(function() { var id = $(this).attr('rel'); var msgCount = '<%= Model.ElementAt('+id+').MailCount %>'; }); <%= Model.ElementAt('+id+').MailCount %> doesn't work. so how do i add a javascript variable to a serverside query this? ...

asp.net MVC and RESTful routing, rails-style. Is it possible?

Is there any way to get truly restful routing working in MVC, just like the rails dudes have? I 'm talking about nested urls like /bands/metallica/albums/killemall/track/4 The only library that I found to be useful is Steve Hodgkiss' Restful routing. It seems though a bit risky to base my whole project's routing on this guy's pet-projec...

How do I merge aspx pages MVC?

I want to merge a sidemenu.aspx on another (Home.aspx, Phone.aspx, Car.aspx... etc) page. How do I do that? ...

How do I redirect to a website using MVC?

I am having a hard time figuring out how to redirect to an outside source. in my code, I have <%= Html.ActionLink("New Name Search", "Index") %> which will allow me to navigate within the code. how do I redirect to ...google for example? ...

Returning a view with it's model from an ActionFilterAttribute

When implementing error-handling using the built-in validation-helpers on a strongly-typed view, you usually create a try/catch block within the controller and return a view with it's corresponding model as a parameter to the View() method: The controller public class MessageController : Controller { [AcceptVerbs(HttpVerbs.Post)] ...

Unexpected side effect of HtmlHelpers in ASP.NET

I have an ASP.NET MVC form for adding a module to a site. The view has a strongly typed ViewModel with the properties "Name" and "Content". On this form I have a sub-form for adding a section to the module. The sub-form has fields labeled "Name" and "Content" as they apply to the section object. However, unfortunately for me, the built-i...

DropDownList item not selected

I'm obviously still missing something about how to bind the selected item in a DropDownList. I set up the SelectList like this in a repository: public SelectList GetAgencyList(System.Guid donorId, Int32 selected) { AgenciesDonorRepository adRepo = new AgenciesDonorRepository(); List<AgenciesDonor> agencyDonors...

Store Master Page in Database?

Using Asp.Net MVC is it possible to store a Master Page in a database so I can have different editable Master Pages for different users? ...

Format ASP.Net MVC app for desktop and mobile browser

I am working on an ASP.Net MVC application that with views that I want to be able to format for desktop browsers as well as mobile browsers. Both formats would use the same Controllers and Actions but require different views. What's the best way to do this? Do I do a browser detect in the Action and then invoke the appropriate view?...