Hi everyone,
I'm just about to start a new project on ASP.NET MVC using LINQ to SQL for ORM. So, I have read and watched various tutorials about best practices and I wonder:
What is the benefit on using the pattern Pipes&Filters in my model (have in mind, I intend to use LINQ to SQL). Why just not use repository pattern in the model for...
Suppose the following route:
{region}/{storehouse}/{controller}/{action}
These two parameters region and storehouse altogether identify a single entity - a Storehouse. Thus, a bunch of controllers are being called in the context of some storehouse.
And I'd like to write actions like this:
public ActionResult SomeAction(Storehouse sto...
I have an Application level variable that gets loaded from a database when the application starts. Now when accessing the variable, I check to see if it is not null. If it is not null I use it, if it is null I initialize it from the database, then use it.
My question is how can I make sure that this variable is refreshed atleast once a ...
Firstly, my previous question will help give some back story.
As stated in that question, I have a super-type table (if that is the technical term for it) and I have multiple sub-types in different tables - all with field unique to that sub-type.
Events
* Id
* EventTypeId
* AllEventTypes_Field
EventType0
* EventId (FK)
* EventType0_Fi...
I'm rewriting a Web Forms application as an exercise to learn some MVC skills.
I have a number of LinkButtons on the original application which postback and raise a serverside event that rebinds data to a datagrid.
E.g.
Event handlers:
protected void lbtnOffset0_Click(object sender, EventArgs e)
{
Sessio...
I have 2 projects in my solution.
MVC Web application
Class library
The MVC Web application references the class library.
The class library contains a class that extends the default ASP.Net Controller.
I'm putting a variable in session in the application's Global.asax.
protected void Session_Start(object sender, EventArgs args)...
Hello
I have a view that both edits and creates "usergroups". And I have a "usergroup-detailsview" (Admin/Usergroup/43) where I have 2 links:
Html.RouteLink("Edit", "UsergroupEdit",
new { usergroupID = Model.Usergroup.UsergroupID })
Html.RouteLink("Create", "UsergroupCreate")
In my global.asax I got:
routes.MapRoute("Usergroup...
I am using .net MVC 2.0 and have set up an edit view that receives a custom ViewModel object. The ViewModel is a class with two properties:
// Properties
public Portfolio Portfolio { get; private set; }
public SelectList slSectors { get; private set; }
In my view there is a form with the purpose of updating the Portfolio Object. The...
I'm working on an application that manages people and their spouses, if married. Essentially a person will be entered and then from that person I want to be able to add a spouse. My database schema is like this. Persons (Person_ID, Name, BirthDate, etc...), Marriages(Marriage_ID, Husband_ID, Wife_ID, Date).
The process is Add a Per...
I've got a route that looks like this:
routes.MapRoute(
"BlogTags",
"Blog/Tags/{tag}",
new { controller = "Blog", action = "BrowseTag", viewRss = false }
);
And I create a URL using that route like this:
<%= Html.RouteLink(Html.Encode(sortedTags[i].Tag),
new { action = "BrowseTag", tag = sortedTags[i].Tag })%>
However, wh...
Ok so I'm using ASP.NET MVC. I'm supposed to upload a file and write it to a network share.
I'm getting "Logon failure: unknown user name or bad password." when I try to write to the network location.
I solved it on my machine by impersonating the file server account, added this to web.config:
<identity impersonate="true" userName="xx...
I am trying to do the following.
Use the default model binder to bind an object from query string values.
If that fails, I then try and bind the object from cookie values.
However I am using dataannotations on this object and I am having the following problems.
If there are no querystring parameters the default model binder doesn't...
Can I run a MVC 1 application using the MVC 2 assemblies without a hitch? I understand that some 3rd party tools have had stuff broken in MVC 2, but let's assume I'm not using those any other tools.
...
I have some jQuery that looks like this:
$.ajax({
type: "POST",
url: "/Customer/CancelSubscription/<%= Model.Customer.Id %>",
contentType: "application/json",
success: refreshTransactions,
error: function(xhr, ajaxOptions, thrownError) {
alert("Failed to cancel subscription! Message:" + xhr.statusText);...
ASP.NET (.aspx) pages have a <%@ Page %> declaration at top that includes an Inherits="" attribute. ASPX pages inherit from System.Web.UI.Page declarative-ly.
My question is, what code actually converts the aspx page into an object of type System.Web.UI.Page class? Where in the lifecycle does this take place and what class is responsi...
I've seen some similar questions, but none that look like what I'm trying to do.
This is my current implementation w/out any security:
<div id="menucontainer">
<ul id="menu">
<li><%= Html.ActionLink("Main List", "Index", "AController")%></li>
<li><%= Html.ActionLink("Product List", "Ind...
Would it be possible to create a MVC root application (Portal with masterpages and themes) and add a couple of WebForms based subprojects (we already have an existing WebForms application that we would like to integrate into the Portal)?
How would you centralize navigation (sitemaps, url routing)?
How would you share the masterpages?
Ho...
Hey guys
Just wondering how and when people are using Editor/Display Templates vs. Html Helpers. Specifically I am talking about its use in rendering different UI control rather than rendering entities.
For instance, I have something like the following atm:
<tr>
<th><%= Html.LabelFor(x => x.ActivityTypeId) %></th>
<td><%= Html...
how do people deal with extra data needed to render a list.
eg I have a IList<User> Users that is a property on my viewmodel. However for each row in the user table, extra information needs to be displayed.
should i create a display model for User with the other properties included on it?
any ideas would be greatly appreciated?
...
I have master page that has this control that accepts Post verb. My LogOn page is also tied to the master page. When I enter wrong username/password, method of that control that accepts verb also gets fired along with the method to accept username password.
This is on HomeConroller:
[ActionName("ControlTemp"), AcceptVerbs(HttpVerb...