Tagged Questions
The asp.net-mvc-3 tag has no wiki summary.
4
votes
1answer
109 views
Custom route for writing friendly URLs in ASP.NET MVC 3
I'm trying to build friendly URLs like this /post/1/my-first-post. I started out with building my links like this:
@Html.ActionLink(Model.BlogPost.Title, "Index", "Post", new
{
id = ...
1
vote
2answers
109 views
Renaming file in C# on Server
I am using the following code to rename the uploaded files for any future name clashes. Please tell if my approach is right or I should follow some other approach or approach which is better.
...
1
vote
1answer
68 views
Optimising multi-part LINQ to Entities query
I have inherited an application which uses LINQ-to-Entities for ORM and don't have a great deal of exposure to this.
There are many examples like this throughout the application and I wondered if ...
1
vote
2answers
97 views
ASP.NET MVC using Repository pattern - code review
I am just trying to use ASP.NET MVC using repository pattern. Could somebody see If I am doing something wrong here.
Model - Contains the model
public class Contact
{
public int Id { ...
2
votes
2answers
93 views
How can i reduce this code size?
There are 28 check boxes. They are given a common name and have different values:
<input type="checkbox" name="Schedules" id="checkbox1" value="1">
In controller in post action:
public ...
2
votes
1answer
115 views
EF+ASP .NET MVC3. The way to realise data access
There are a several articles about true data access in MVC. I tried to make the best one according to the architecture flexibility. My way is following:
ADO .NET Entity Data Model (*.edmx from ...
3
votes
1answer
133 views
Need help with cleaning up this Controller
I've written the following controller and i was looking for some input/advice on how i could go about cleaning this up or rewriting it. I feel like i'm repeating myself a lot or that there might be a ...
3
votes
0answers
186 views
ASP.NET MVC: Please review my implementation of a generic DropDownList attribute and templating solution
My goal was to be able to render my view models using a standard Object.cshtml editor and display template. In order to do so I needed to be able to always call Html.Editor(propertyName) or ...
2
votes
2answers
109 views
Using IDisposable to stripe a table
What are your thoughts on using an IDisposable to stripe an HTML table like so. It's a blatant abuse of IDisposable but this allows you to use the counter in a using(){} block which gives you a clear ...
5
votes
2answers
257 views
trying to optimize conditional string building
Essentially I'm taking a number of checkboxes off of my view, adding them to a Dictionary<string, bool>, and writing out the Keys of any checkbox that is checked.
I'm guessing there must be a ...
2
votes
2answers
162 views
Repetition in Controller code
In the index view a user can search with any combination of one to all of the following parameters: firstname, lastname or ssn. The found search results are displayed in the search results view. In my ...
1
vote
1answer
173 views
Use of Ninject and an injectable DataLayer in MVC3
I'm trying to make an MVC3 application with an exchangeable data layer and below is the code I have currently. In a single file (Global.asax.cs) for brievity.
It seems to be working as I want but as ...
2
votes
4answers
407 views
Is there a better way to do dynamic filtering and sorting with Entity Framework than this?
I'm developing an application using ASP.NET MVC 3 and Entity Framework 4.1. In that application I have a lot of paged lists. Users can filter and sort these lists.
This results in code like the one ...
-1
votes
1answer
137 views
Placing Javascript in an external source rather than embedded in the page [closed]
I've always placed my javascript embedded in my ASP.NET MVC pages. I vaguely remember an old practice that suggests placing all javascript in external files. Is it more appropriate to place it in your ...
3
votes
4answers
207 views
Is it overkill to create a Model for this?
Email<input type="text" id="email" /><br />
Re-enter Email<input type="text" id="confirm-email" />
I'm thinking that I want a model so that I can have this partial page strongly ...