asp.net-mvc

Very weird behavior with Linq to SQL and MVC

I have an Action that requires authentication. The action method creates some records with foreign keys using Linq to SQL. When the user calls the action and is logged in the method works without a problem. When the user is not logged in, MVC redirects them to the login page with the returnUrl parameter. After a successful login the acti...

Assert.AreEqual failed on two identical MVC ViewModel results?

I got this error on my unit test: Assert.AreEqual failed. Expected:<ShizoMe.Web.ViewModel.AccountViewModel>. Actual:<ShizoMe.Web.ViewModel.AccountViewModel>. This is the code for my test: [TestMethod] public void Register_Prevents_Duplicate_Users() { var controller = GetAccountController(); var model = new A...

Silverlight 4 MediaElement Source Uri problems

I am having issues with setting the Silverlight 4 MediaElement Source property in my ASP.NET MVC 2 application. I have a Windows 7 development machine and a Windows Server 2008 staging server. Locally I have been using a MediaElement source like: <MediaElement x:Name="VideoMediaElement" Source="Assets/126.mp4"> ... </MediaElement> Th...

Return all fields from strongly typed object from View in MVC

I have a view where a supervisor selects if something is approved or not and enters a comment. Most of the fields are not displayed for this view. The view is strongly typed. I was curious how I can return the whole object back to the controller. It appears like it just returns the fields I have on the form. ...

ASP.NET MVC - Routing still confusing for me.

Hi everyone. I'm having difficulty with the concept of Routing within the ASP.NET MVC Framework. For example, I have a controller method: public class UploadController : Controller { public ActionResult Index() { return View(); } [AcceptVerbs(HttpVerbs.Get)] public ActionResult GetChildFolders(string id) {...

Changing a page from DropDownList using jQuery

Hello SO: I have a simple jQuery script that selects the current page from a static dropdownlist, and when the selection changes the script also modifies the href attribute of an anchor tag to reflect the navigation change. Here is my code: <select name="PageSelectDropDown" id="PageSelectDropDown"> <option value="Insulation">Insul...

What is the best implementation for changing the database schema at runtime using Entity Framework 4?

We are building an ASP.Net MVC 2 multi-tenant application on SQL Server using the "single database, separate schema" model discussed, among other places, here and here, where each tenant has one or more users and is split out with its own, tenant specific, SQL Server schema. The application is using Entity Framework 4. In order for u...

PartialView Render Forms timeout

I'm fetching a partial view via $.ajax() and in the situation where you set idle for 30 minutes and then try to fetch that partial view, the forms authentication has timed out and instead of getting my partial view returned to me, I'm getting the login page render into my . Any suggestions on how to deal with a situation like this? T...

Are strongly typed ASP.NET MVC views smelly for composite models

Consider 2 options for a real-world application that needs to build a model, a composite model if you will, from a variety of sources the choices for for using strongly typed views: Create a new custom class for the model with a property for each piece of information that needs to be passed to the view stage, Confine the models to the ...

URL Routing across multiple subdomains

I find myself in a difficult situation. We're working on an ASP.NET MVC 2 application which is comprised of multiple sections. It is a design goal to have these sections span across several subdomains. Each subdomain will have its own controller. The challenge is that our hosting provider's control panel allows two forms of redirection ...

How to create downloadable file links in asp.net mvc?

How can I make downloadable file links in asp.net mvc for downloading the files? Also how can I show the file as thumbnail in my page in asp.net mvc? ...

How to get Action information from RouteData?

Hi All, I'm using following code to get the controller/action information from RouteData RouteData route = RouteTable.Routes.GetRouteData(httpContext); string controller = route.GetRequiredString("controller"); string action = route.GetRequiredString("action"); But should I change the string "controller" in case that the route map in...

.net template 'if null' check in vb - syntax?

I am new to .net completely and I just need to know the syntax, or possible functions to put in my if statement to check if <% If Model.contacts Is Null Then%> which isn't correct. Where Model.contacts comes from my ClientViewModel, and Model.contacts is of type System.Linq.IQueryable(Of Contact) Here is the code for addresses... <% ...

How to do background processing similar to that on stackoverflow?

I know that stackoverflow uses asp.net mvc but how they do background process (ie) processing a recent user updates,badges etc.... How to get started with background processing in asp.net mvc... ANy suggestion... I just saw jeff's post private static CacheItemRemovedCallback OnCacheRemove = null; protected void Application_Start(objec...

Manipulating page scrolling when returning a View in an ASP.NET MVC site

I'm building an ASP.NET MVC site where I want one of the Views I return to be automatically scroll to a certain point. The part of the site where I want this to occur works sort of like a forum - there are "threads" that contain "posts". A user can either browse to the whole paginated thread or can browse to a specific post, using its I...

jQuery Grid for MVC data not coming from controller to view

I just downloaded jQuery Grid for ASP.NET MVC from codeplex I did run the project, all seams to be all right, in Sql Profiler i can see that sql queries coming to database. Then in debugger i can see that data comes in LinqToSql query fine: var model = from entity in repository.Index().OrderBy(sidx + " " + sord) select new { ...

ASP.NET Webforms with jQuery?

Can I avoid using MS AJAX completely while developing ASP.NET Webforms applications and use jQuery/jQuery Tools instead? jQuery seems to be much snappier, has better community, extremely small file size (24kb). It's also seems like an obvious choice for ASP.NET MVC development. But what about Webforms? I really would rather not use AJA...

How to open web.config

Hi all, I'm using following code to open the web.config of my current web application. Configuration rootConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/MyAppRoot"); But it only works on my development machine, not production machine. Shall I use something else other than "/MyAppRoot"? Thanks in adva...

switch from asp.net mvc 1.0 -> 2.0

Hi, I am currently trying to move from asp.net mvc 1.0 to 2.0 in an existing solution (s#arp framework). Most things seem to work fine apart from unexplainable error messages: Compiler Error Message: CS0828: Cannot assign method group to anonymous type property Source Error: Line 10: <p> Line 11: [ Line 12...

disable and select asp.net mvc Html.RadioButtonFor

How can i set selected = true and disable this radio button <%= Html.RadioButtonFor(m =>m.AddToLevel ,new {id = "rdSameas" }) %> ...