asp.net-mvc

Rendering an ActionLink programmatically

I have a scenario where I'd like to render an ActionLink programmatically, ether from a controller or ideally an extension method. This is so I can wrap up some logic of wether to display the link and remove that logic from my view. I can create an ActionLink using the MVC Futures project from CodePlex. ActionLink actionLink = new Acti...

ASP.NET MVC 2 - How do I pass a querystring back on response?

I need to pass a querystring back on response - so that via means of jQuery I can do something with it. something like this: return RedirectToAction("LogOn", "Account", new { id = "?action=update" }); URL needs to end up like: ../Account/LogOn/?action=update but the above code produces this instead: ../Account/LogOn/%3faction%3dupdate...

How to build a generic repository

I'm developing a web application in ASP.NET MVC with NHibernate. Based in articles and tutorials I've found at Google, I'm using Repository for my classes. I have 10 classes and 10 repositories. Today I figured out that 90% of mine repositories are exactly equal each other, except for the class. This is one example: public class Promo...

Unable to start debugging on the web server. The web server could not find the requested resource.

I'm having this error trying to debug my ASP.NET MVC app. I've set the app to "Use Local IIS Web server", and selected ASP.NET as the debugger. Running the site without debugging works just fine, but when I try to debug, I got this error: Unable to start debugging on the web server. The web server could not find the requested source. ...

how to test web farm through software

Is there are any soft which allow simulate web farm. (something like virtual machine with multiple IIS). I'm going to test the my app on cluster and try to find the way which easier then creation of multiple virtual machines. Thanks ...

relative client url to http url

I have a property of a model class that contains a relative url to a file. ~/_docs/folder/folder/document.pdf How I can, in the view, transform it to an hyperlink to download the file itself? thanks ...

Using MVC 2 view user control for a GET

I'm converting a classic ASP page to ASP.NET MVC 2. I have a simple form on the page that runs a search. Here's the code: <form id="searchbox" action="/search.asp"> <input type="text" name="q" /> <input type="submit" value="go" name="sa" /> </form> The "/search.asp" page will stay, my new MVC page will just use it. So the fo...

Error Validating Models where table fields don't allow nulls

Hello, I am using .NET 4.0 and the entity framework to do some server side validation. I have a simple table called "Contacts" which looks like this: ID int Dont Allow Nulls FirstName nvarchar(50) Dont Allow Nulls SecondName nvarchar(50) Dont Allow Nulls MobileNumber nvarchar(50) Dont Allow Nulls HomeNumber nvarchar(50) Allow Nulls ...

How do I use StructureMap with generic unclosed types using Scan with a "greedy" constructor

Between various Stack Overflow questions and blog posts there is a pretty reasonable amount of documentation on the topic of open generics and StructureMap. Unfortunately, I must be missing something as my attempts at using scan to perform the configuration along with a class implementation that has a "greedy" constructor have yet work. ...

ID value is being changed when added to database, different from posted and submitted values.

I have a form that creates a new brand. The user chooses a name, image, and website url for the brand and hits submit. The edit scenario works the same way. The issue I'm having is when creating a new brand, the correct imageId is being posted, and right up to SaveChanges() in my action its correct. When I check the new row in the databa...

How can I populate the textbox of an HTML file input?

This one has got me stumped. I am currently rendering a form using ASP MVC, it has a bunch of fields, one of them is an <input type="file"... The file upload works great, but when I return the form to the user, the textbox that contains the file is empty. I would like to show the filepath in the textbox, but it appears the value field...

ASP.Net MVC 2 Areas: The partial view '...' was not found

We recently upgraded a project to MVC 2 and we'd like to use Areas but there is an issue. We have created a new area, setup a controller, configured a route, and created a view in the correct location. When we run the code it successfully finds the route and hits the controller but when it goes to render the view there is an exception....

ajax.beginform inside a for loop

so I am using a foreach loop to iterate through comments. The comment section is wrapped inside "Comments" div. My function DeleteComment fetches comments again once you delete a comment and rebinds it to the control. However, after you delete a comment, anytime you try to delete another comment, the commentId of the very first deleted c...

ASP.NET MVC MODEL - Passing Joins created on Models to Controllers and Views with scaffold

Hi, this is the case: ASP.NET MVC C# Model: I would like to use information defined on three tables, Product - Details - Pictures. I created a ProductRepository and defined a join of the three tables. Finally I select fields from each of these tables. public IQueryable ProductsList() { var db = new Entities(); v...

jqgrid in asp.net mvc

how to start working with jqgrid...basics about how to use jqgrid in asp.net mvc application. means wat namespace to be included...and all ... thanks in advance ...

ASP.NET page content in database vs file performance?

I am creating a site whose content is dynamic and has images in it. What/How much performance hit will my DB (MSSQL) take if I save content/Images in DB? I am just trying to understand what kind of problems I may run into. I appreciate any responses. Thanks! ...

asp.net mvc routing - rewrite url

after debbuging i am getting following url of my webproject: http://localhost:54594/Home/Home /Home-Controller/Home-Action http://localhost:54594/AboutUs/AboutUs /AboutUs-Controller/AboutUs-Action http://localhost:54594/Products/Products /Products-Controller/Products-Action In my global.asax i ha...

MVC: How do I create link on server side

Hello. I want to be able to pass link to view from controller. Is there anything like Html.ActionLink on the server side? Thank you for your help! ...

When/why to use sqlite with asp.net MVC/Webfoms?

I really dont know why people use sqlite. As i just gone through some Top voted sqlite question i can't get the point. So can someone suggest the point When/why to use sqlite with asp.net MVC/Webfoms? EDIT: Any good sample asp.net web application that uses sqlite for getting started? ...

ASP.NET webforms wildcard route

I'm using asp.net routing in a webforms app. I would like to achieve the following url format: http://[domain]/{parent-category}/{sub-category}/{sub-category} where the right most category is available as a route value. Currently I have achieved this with the following route: routes.MapPageRoute( "category-browse...