asp.net-mvc

Are there events for before a controller is run?

I know there are events for before/after a action is fired. Is there anything higher up in the stack like before a controller is called? ...

How can I read the properties of an object that I assign to the Session in ASP.NET MVC?

Hey all, I'm trying my hand at creating a session which stores member information which the application can use to reveal certain navigation and allow access to certain pages and member role specific functionality. I've been able to assign my MemberLoggedIn object to the session in this way: //code excerpt start... MemberLogg...

Does it make sense to create a custom resource.xml instead of using asp.net's Resource .resx implemention?

I will be setting the current thread's culture at the beginning of the request lifecycle. Does it make sense if I create my own resource.xml to store things like strings/labels/messages that will be used in the web application? or are their drawbacks and its better if I just use the Global resources .resx files that are 'built-in' ? ...

Why are awkward numbers and letters in my query string??

Hi everyone!! I have a MVC website and when I execute it, the query string (url) that appears is: http://localhost:6970/(S(51aegi45qneolxa0oxwuzh55))/default.aspx what the hell is that strange combination of numbers and letters??? please help!!!!! previously i had been working with the session expires to redirect to one of my views, co...

How to remove dangerous characters(ie script tags)?

I am wondering is there any sort of C# class or 3rd party library that removes dangerous characters such as script tags? I know you can use regex but I also know people can write their script tags so many ways that you can fool the regex into thinking it is OK. I also heard that HTML Agility Pack is good so I am wondering is there any ...

ASP.NET MVC 2.0 does not install with visual studio 2010 professional?

Hi all I installed vs 2010 and it should have asp.net mvc 2.0 but it didnt install it. I tried installing it manually but it still does not show under the new projects tab..but it shows installed in control panel. I had vs2010 rc1 before and uninstalled it and it had mvc 2.0 but now for some reason i dont have it! ..Can anyone please he...

What is the canonical way to return a json object in asp.net webforms programming?

In ASP.Net MVC action methods can return json objects simply by returning something like so: JSon([whatever]) How do I return a JSon representation of say List<String> with webforms either through a service or through a method in the code behind of an aspx page? This seems incredibly confusing compared to ASP.Net MVC. ...

Which ASP.NET MVC controls toolset do you prefer?

I have seen demos of ComponentArt's and Telerik's toolsets. I am interested mainly on finding a grid control, a tabstrip control, a menu control and a treeview control Do you know any company besides the forementioned that offers ASP.NET MVC controls solutions? Which one do you think is the best/most reliable? ...

How to filter the drop down list by using other drop down list in asp.ner MVC

hello, everyone, I encounter a problem when I try to filter the drop down list. The situation is I wish to filter the Agent dropdown list by using the Company dropdown list in same view/form. Since I need to display the Agents that only belong to the selected Company. But I have no idea to do that. Any solution, please? ...

How would you show which tab is selected on a website built from a template?

When you click Questions, Tags, Users etc. at the top of stackoverflow, the one you're looking at becomes highlighted orange. This is (usually) done by changing the css of one of them to be 'selected'. If you have a single template that all your pages are built with, and that template includes these buttons across the top, how do you hi...

mvc ajax.actionlink with jquery dialog confirm

I have a table with some rows of data items. For each row it will be some actionlinks that will call some methods (delete dataitem, change status dataitem etc...) Before each user clicks the button i want a jquery dialog to show up and give the user a dialog with some info, a OK and Cancel button. Some example code of the ajax.actionli...

Asp.net mvc return data from codebehind of aspx page

Hi there I have a situation where I need to make to call to a normal .aspx page from asp.net mvc web application. How can I make this request and get data back from the page. the data will be returned on on the page_load event of the .aspx page ...

MVC validation error with strongly typed view

I have a simple form that I would like to validate on form submission. Note I have stripped out the html for ease of viewing <%=Html.TextBox("LastName", "")%> //Lastname entry <%=Html.ValidationMessage("LastName")%> <%=Html.TextBox("FirstName", "")%>//Firstname entry <%=Html.ValidationMessage("FirstName")%> <%=Html.DropDownList("JobRo...

Inject different repository depending on a querystring / derive controller and inject the repository depending on the controller type / ASP.NET MVC

I have a search form that can search in different provider. I started out by having a base controller public SearchController : Controller { protected readonly ISearchService _searchService public SearchController(ISearchService searchService) { _searchService= searchService; } public ActionResult Search(....

how to use jquerydate picker with partial views in asp.net mvc?

hello i am working on asp.net mvc. at staring i used the jquery which works fine but now i am converting my pages in to partial pages at this point am using ajax function to convert it in to partial view but every thing is working fine except date picker plz tell me the solution. the script that i have used: ...

How does MVC ViewData work?

I am toying around with an MVC application just to learn the technology. I am mocking up a check register application that keeps track of a checking account, what has cleared the bank and what has not. I am using EF for my model and everything seems to be working correctly insofar as Edit, Create, etc. However, I have a couple of totals ...

Reload jquery autocomplete in the on change event of a drop down

I have country,state dropdowns and a city textbox with autocomplete feature.My issue is,when I change state, it is displaying previously selected cities since city autocomplete takes data from cache instead of calling server with new stateid.City autocomlete request server response with new stateid only if the cities are not in the selec...

How to get current route information in OnActionExecuting

my urls look like: www.example.com/{languagecode}/{controller}/{action}/{id} where language code is en-us, etc. From the OnActionExecuting event, how can I get these values? ...

ASP.NET MVC normal edit form with upload (and validation) using jQuery UI Modal

Hi all, I have a form that resides inside a jQuery UI dialog, the form have some fields such as first, last name, etc... and also allow file upload. I can't use Ajax.BeginForm() since ajax doesn't allow upload (or does it?), so I have to use the regular Html.BeginForm() for my form to call my ActionResult. But I need to do some validati...

Need advice on multitab form in ASP.NET MVC

Hi all, i need an advice on how to implement my form. I have a requirement: i need a form that spans through 5 tabs. Each tab has around 10 fields, some of them empty, some of them must contain data from db and be non editable. Each of these tabs must be a part of one form that is submitted to my controller. The question is: what is th...