Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads
 
Add your own
alternative version

Implementing Model-View-Presenter in ASP.NET

, 17 Nov 2007
Three implementations of Model-View-Presenter in ASP.NET 2.0.
MVPSampleApp.zip
MVP.SampleApp
Lib
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
MySql.Data.dll
nunit.framework.dll
Rhino.Mocks.dll
Model
Data
Interfaces
Properties
Presentation
Presentation.Tests
Properties
Interfaces
Properties
SubSonic
ActiveRecord
Builder
CodeGeneration
Templates
CodeLanguage
Configuration
Controls
Calendar
lang
skin
active-bg.gif
calendar.gif
dark-bg.gif
hover-bg.gif
menuarrow.gif
normal-bg.gif
rowhover-bg.gif
status-bg.gif
title-bg.gif
today-bg.gif
Resources
DataProviders
Properties
Sql Tools
SubSonic.snk
Sugar
WebApp
App_Data
Views
SQL2000SampleDb.zip
<%@ Page Language="C#" %>
<%@ Import namespace="SubSonic.Utilities"%>
<%@ Import Namespace="SubSonic" %>
<% 
	string masterPage = "#MASTERPAGE#";
	string tableName = "#TABLENAME#";
	string className = "#CLASSNAME#";
	string language = "#LANGUAGE#";

%>
<%
	if (!String.IsNullOrEmpty(masterPage))
	{
%>

[<]%@ Page Language="<%= language %>" Title="<%= className %> Scaffold" MasterPageFile="<%= masterPage %>" Theme="default" %[>]
[<]%@ Register Assembly="SubSonic" Namespace="SubSonic" TagPrefix="cc1" %[>]
[<]asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server"[>]
	[<]div[>]
		[<]cc1:Scaffold ID="Scaffold1" runat="server" TableName="<%= tableName %>" GridViewSkinID="scaffold" EditTableItemCaptionCellCssClass="scaffoldEditLabel" ButtonCssClass="scaffoldButton" TextBoxCssClass="scaffoldTextBox"[>]
		[<]/cc1:Scaffold[>]
	[<]/div[>]
[<]/asp:Content[>]

<%
	}
	else
	{
%>

[<]%@ Page Language="<%= language %>" Title="<%=className%> Scaffold" %[>]
[<]%@ Register Assembly="SubSonic" Namespace="SubSonic" TagPrefix="cc1" %[>]
[<]!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[>]
[<]html xmlns="http://www.w3.org/1999/xhtml" [>]
[<]head id="Head1" runat="server"[>]
[<]script language="javascript" type="text/javascript"[>]

	function CheckDelete()
	{ 
		  return confirm('Delete this record? This action cannot be undone...'); 
	}

	function imposeMaxLength(e, Object, MaxLen, rowIndex)
	{
		var keyCode = e.keyCode;
		var counter = document.getElementById('counter' + rowIndex);
		var charText = Object.value;
		var charCount = charText.length;
		var charRemain = MaxLen - charCount;
		counter.style.visibility = 'visible';
		if(keyCode == 8 || keyCode == 46)
		{
			if(charCount == MaxLen)
			{
				charRemain = 1;
			}
			else if(charCount == 0)
			{
				charRemain = MaxLen;
			}
			counter.innerHTML = charRemain;
			return true;
		}
		else
		{
			if(charRemain [>] 0)
			{
				counter.innerHTML = charRemain;
				return true;
			}
			else
			{
				Object.value = charText.substring(0, MaxLen);
				counter.innerHTML = '0';
				return false;
			}
		}
	}
[<]/script[>]
[<]/head[>]
[<]body[>]
	[<]form id="form1" runat="server"[>]    
		[<]div[>]
			[<]cc1:Scaffold ID="Scaffold1" runat="server" TableName="<%= tableName %>" GridViewSkinID="scaffold" EditTableItemCaptionCellCssClass="scaffoldEditLabel" ButtonCssClass="scaffoldButton" TextBoxCssClass="scaffoldTextBox"[>]
			[<]/cc1:Scaffold[>]
		[<]/div[>]
    [<]/form[>]
[<]/body[>]
[<]/html[>]
<%	    
	}
%> 

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Alex Mueller
Web Developer
United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 17 Nov 2007
Article Copyright 2007 by Alex Mueller
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid