asp.net-mvc

URL Rewritting + ASP.NET MVC

Hi Guys I have a issue that they users here want urls like http://host/Post/PostTitle Is this possible? As your not passing in the action? regards ...

MVC Widget within a form

I'm using ASP.NET MVC, and I have a widget within my form collection on my HTML page, and when I click on the save button for the main form I would like not only to save the data on the main form but also the content on the widget, how can I do this? ...

2 controller and 1 view in ASP.NET MVC

I have 2 controllers, task and user. I need to create a view for "create task to users". So I need "a user list" and "create task" view together. Usually views inherit from only 1 class. How can I create a view working with 2 classes? Have any idea? ...

MVC Style Filters on ASMX Web Services, is it possible?

Hi, Is it possible to create MVC style filter attributes (like Authorize or HandleError) that work on ASMX Web Services? Specifically, I perform custom authentication on a number of my web methods and would like to wrap the code into an Attribute that throws an exception, if the authentication checks fail. Rich ...

Update base properties - ASP.NET MVC- c#

I have the following code in a model base.Name = instance.Name; base.SSN = instance.SSN; base.DateModified = DateTime.Now base.ClienType = instance.ClientType; If I add more properties to my base then i have to update my model to update the properties. Is there an easier way to update the base.properties instead of listing each of the...

asp.net mvc - constructing views completely off custom fields in DB

hi- i'm working on designing an asp.net mvc web app. There will be half a dozen (maybe more to come) different user groups of the app and they all work with similar but tweaked UIs, each with a few custom fields but all using the same objects. one idea for creating the UI is to store Control info with each field value in the database...

Silverlight as Javascript replacement for complex Web UI in MVC project?

How practical would it be to use Silverlight inside of an MVC view to achieve a GUI that's rather complex with Javascript (and crippling to non-usable without Javascript)? I know nothing about Silverlight so if this seems like a good idea, how difficult would it be to do so, or vice-versa? Would asking users to install a plugin outwei...

Can I return an edited object back to Controller from my strongly-typed View without having to use Request.Form?

Just wondering, I strongly type these views in ASP.NET MVC and then use Request.Form on the submit controller to get the data out, validate it, put it in an object, send to database. Is there a way I can just send the object back from the View page since it is strongly typed instead of doing all this crap to just end up with an object ag...

How to return PDF to browser in MVC ?

I have this demo code for iTextSharp Document document = new Document(); try { PdfWriter.GetInstance(document, new FileStream("Chap0101.pdf", FileMode.Create)); document.Open(); document.Add(new Paragraph("Hello World")); } catch (DocumentException de) { Console.Error.WriteLine(...

ASP MVC won't render selected value for a Select List

I can only get the selected value to be selected on an MVC view when I use the ViewData object. If I try to bind directly to a property on my model which returns an Ienumerable it won't render the Selected tag into the html. I am at a loss on this one. Note: I do pass a strongly typed value to the View so my orginal binding was Model...

IModelBinder or IOC in ASP.NET MVC?

While Scott Hanselman performed an excellent demonstration of the use of IModelBinder in “IPrincipal (User) ModelBinder in ASP.NET MVC for easier testing” he felt compelled to make this rather defensive comment: Yes, I realize I could use an IoC container for this also. Did he mean that he could have used IOC instead of IModelBind...

Get FormCollection out controllerContext for Custom Model Binder

I had a nice function that took my FormCollection (provided from the controller). Now I want to do a model bind instead and have my model binder call that function and it needs the FormCollection. For some reason I can find it. I thought it would have been controllerContext.HttpContext.Request.Form ...

Having trouble deplying ASP MVC app to normal shared hosting provider

I bought the Windows Developer hosting package from fasthosts.co.uk, which I believe is a bog standard shared hosting package. It has ASP.NET 3.5 and, according to their support, also has SP1 installed. I have developed my web app using ASP MVC 2 preview 1 (which by the way is awesome and I'm looking forward to getting stuck into previe...

Help with naming my admin related controllers

I can't come up with a nice name for my admin related controllers. I have a UserController that is used for the site (non-admin related actions). Now I created an ADMIN section that has the following url format: www.example.com/admin/{controller}/{action}/{id} My controller folder is layed out like: /controllers/ /controllers/admin/...

in my global.asax, can I output the current route/action being fired?

in my global.asax, can I output the current route/action being fired? this is the debug something. ...

using IDataErrorInfo in asp.net mvc

I've got a simple address entry app that I'm trying to use the IDataErrorInfo interface as explained on the asp.net site. It works great for items that can be validated independantly, but not so well when some items depend on others. For example, validating the postal code depends on the country: private string _PostalCode; pu...

html helpers for dropdown lists?

Hi, Are there any helpers for displaying dropdownlists in asp.net-mvc? I have an enumeration that I need to populate, and pre-select in a dropdownlist. ...

How to get all records from thisa year onwards from LINQ to SQL model?

Can anyone tell me an efficient way of returning this. I have: var allPrices = site.Prices.AsQueryable(); I now want to query allPrices from current year onwards. Thanks ...

Why Does the Entity Framework make so Many Roundtrips to the Database?

Hello, I am rewriting my application to use the entity framework. What I am confused about is the code I am writing looks like it is making unnecessary tripts the the sql server. For example, I have a question answer site similar to SO. When I add an answer to a question -- here is the code I use: var qu = context.question.where(c => c....

What techniques are being used to pass MVC ModelState validation errors back to the client when using JsonResult?

I'm sort of thinking out loud here, so let me know if I need to clarify... on ajax heavy sites, when using JsonResult to pass information back to the client, what techniques, patterns, best practices are being used to pass ModelState validation errors back to the client? I am using xVal and castle validation on my view models, is there...