Click here to Skip to main content
15,884,017 members
Articles / Web Development / ASP.NET

Three Tier Code Generator For ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.78/5 (34 votes)
8 Jul 200512 min read 425.2K   22.2K   251  
Generates three tier code for ASP.NET.
<%

Function AddPageCodeBehind()
	AddPageCodeBehind =	PageComments("Add"& ActionFile & ".aspx" & GetFileExtension(CodingLanguage), AuthorCompany, "") &_
				StartPageClass(WebNamespace() & ".SitePage", "Add"& ActionFile, WebNamespace() & ", " & BusinessNamespace(), "") & vbCrLf &_
				DeclareAddEditCntrl(0, vbTab & vbTab) & vbCrLf &_
				DesignerGeneratedCode("Add", vbTab & vbTab) &_				
				AddPageLoad(vbTab & vbTab) & vbCrLf &_
				AddClick(vbTab & vbTab)  & vbCrLf &_
				EndPageClassBlock("")
End Function

Function AddPage()
	AddPage =	HtmlHeader("Add"& ActionFile & ".aspx", Title, CssFilePath) & vbCrLf &_	
			AddForm() & vbCrLf &_
			HtmlFooter & vbCrLf 
End Function

Function UpdatePageCodeBehind()
	UpdatePageCodeBehind =	PageComments("Update"& ActionFile & ".aspx" & GetFileExtension(CodingLanguage), AuthorCompany, "") &_
				StartPageClass(WebNamespace() & ".SitePage", "Update"& ActionFile, WebNamespace() & ", " & BusinessNamespace(), "") & vbCrLf &_
				DeclareAddEditCntrl(1, vbTab & vbTab) & vbCrLf &_				
				DesignerGeneratedCode("Update", vbTab & vbTab) &_
				GetStatement(Declaration("Private", FieldId, "Int32", "0", CodingLanguage), CodingLanguage, vbTab & vbTab) & vbCrLf &_				
				UpdatePageLoad(vbTab & vbTab) & vbCrLf &_
				EditClick(vbTab & vbTab)  & vbCrLf &_
				EndPageClassBlock("")								
End Function

Function UpdatePage()
	UpdatePage =	HtmlHeader("Update"& ActionFile & ".aspx", Title, CssFilePath) & vbCrLf &_
					UpdateForm() & vbCrLf &_
					HtmlFooter & vbCrLf 
End Function

Function DefaultPageCodeBehind()
	DefaultPageCodeBehind = PageComments("Default.aspx" & GetFileExtension(CodingLanguage), AuthorCompany, "") &_
							StartPageClass(WebNamespace() & ".SitePage", "Default" & Pagesfolder, WebNamespace() & ", " & BusinessNamespace(), "") & vbCrLf &_
							DeclareDefaultCntrls()& vbCrLf &_
							DesignerGeneratedCode("Default", vbTab & vbTab) 
	If BlnDataGridEdit = "1" then	
		DefaultPageCodeBehind = DefaultPageCodeBehind & DeclareDynamicCntrl(vbTab & vbTab)
	End if
	DefaultPageCodeBehind = DefaultPageCodeBehind & DefaultPageLoad(vbTab & vbTab) & vbCrLf &_
							BindDataGrid(vbTab & vbTab) & vbCrLf &_
							DatagridItemDataBound(vbTab & vbTab) & vbCrLf &_
							DatagridSort(vbTab & vbTab) & vbCrLf &_				
							DatagridPageIndexChanged(vbTab & vbTab) & vbCrLf &_
							DatagridDelete(vbTab & vbTab) & vbCrLf 
	If BlnDataGridEdit = "1" then	
	DefaultPageCodeBehind = DefaultPageCodeBehind & DatagridEdit(vbTab & vbTab) & vbCrLf &_
							DatagridCancel(vbTab & vbTab) & vbCrLf &_
							DatagridUpdate(vbTab & vbTab) & vbCrLf &_
							LoopForListCntrlFunctions(vbTab & vbTab) &_
							BindDynamicListControl(vbTab & vbTab)
	End if
	DefaultPageCodeBehind = DefaultPageCodeBehind & EndPageClassBlock("")					
End Function

Function DefaultPage()
	DefaultPage =	HtmlHeader("Default.aspx",Title, CssFilePath) & vbCrLf &_
					DefaultForm() & vbCrLf &_
					HtmlFooter & vbCrLf 
End Function
%>

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
Australia Australia
Stevan is a Microsoft Certified Solutions Developer in .Net Architecture (MCSD.Net Early Achiever – one among the first 2500 worldwide), Microsoft Certified Application Developer in .Net – MCAD.Net (Charter Member - one among the first 5000 developers worldwide).

Comments and Discussions