Advertisement
ASP_Volume3 Files/ File Controls/ Input/ Output #55518

Go Beyond the limitations of ASP.NET Form

In HTML and ASP programming, the form element (i.e., ) features the Action property that programmers use to redirect to another URL after clicking. In ASP.NET, server-side forms are rendered using a class named HtmlForm under System.Web.UI.HtmlControls Namespace. This class doesn't provide the familiar Action property, nor does it supply an alternative property to perform the similar functionality. As a result, the single form interface model is so deep-rooted in ASP.NET that there's no way around it.. This article is concentrating on the aspects of providing the Action property to Server-side form object based on very own HtmlForm class itself which further can be extended to adopt multiple-form interface

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
<style>
 <--
 /* Font Definitions */
 @font-face
 	{font-family:Wingdings;
 	}
 @font-face
 	{font-family:Verdana;
 }
 @font-face
 	{font-family:Garamond;
 }
 @font-face
 	{font-family:"Arial Bold";
 }
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
 	{
 	margin:0in;
 	margin-bottom:.0001pt;
 	text-align:justify;
 	font-size:10.0pt;
 	font-family:Verdana;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";}
 h1
 	{mso-style-name:"Heading 1\,Heading 1 Char Char\,Heading 1 Char1";
 	margin-top:12.0pt;
 	margin-right:0in;
 	margin-bottom:12.0pt;
 	margin-left:.3in;
 	text-align:left;
 	text-indent:-.3in;
 	page-break-before:always;
 	tab-stops:list .3in;
 	font-size:12.0pt;
 	font-family:Verdana;
 	mso-font-kerning:0pt;
 	font-weight:bold;
 	mso-bidi-font-weight:normal;}
 h2
 	{mso-style-name:"Heading 2\,Heading 2 Char";
 	margin-top:6.0pt;
 	margin-right:0in;
 	margin-bottom:6.0pt;
 	margin-left:.4in;
 	text-align:justify;
 	text-indent:-.4in;
 	page-break-after:avoid;
 	mso-outline-level:2;
 	mso-list:l46 level2 lfo72;
 	tab-stops:list .4in;
 	font-size:11.0pt;
 	mso-bidi-font-size:10.0pt;
 	font-family:Verdana;
 	font-weight:bold;
 	mso-bidi-font-weight:normal;}
 h3
 	{mso-style-next:Normal;
 	margin-top:0in;
 	margin-right:0in;
 	margin-bottom:0in;
 	margin-left:.5in;
 	margin-bottom:.0001pt;
 	text-align:justify;
 	text-indent:-.5in;
 	mso-pagination:widow-orphan;
 	page-break-after:avoid;
 	mso-outline-level:3;
 	mso-list:l46 level3 lfo73;
 	tab-stops:list .5in;
 	font-size:10.0pt;
 	font-family:Verdana;
 	layout-grid-mode:line;
 	font-weight:bold;
 	text-decoration:underline;
 	text-underline:single;}
 h4
 	{margin-top:5.0pt;
 	margin-right:0in;
 	margin-bottom:5.0pt;
 	margin-left:.6in;
 	text-align:justify;
 	text-indent:-.6in;
 	mso-pagination:widow-orphan;
 	mso-outline-level:4;
 	mso-list:l46 level4 lfo73;
 	tab-stops:list .6in;
 	font-size:10.0pt;
 	font-family:Verdana;
 	font-weight:bold;}
 h5
 	{
 
 	margin-top:0in;
 	margin-right:0in;
 	margin-bottom:0in;
 	margin-left:.7in;
 	margin-bottom:.0001pt;
 	text-align:center;
 	text-indent:-.7in;
 	page-break-after:avoid;
 	font-size:16.0pt;
 	font-weight:bold;}
 h6
 	{
 	margin-top:12.0pt;
 	margin-right:0in;
 	margin-bottom:3.0pt;
 	margin-left:.8in;
 	text-align:justify;
 	text-indent:-.8in;
 	tab-stops:list .8in;
 	font-size:11.0pt;
 	font-family:Verdana;}
 
 p.MsoToc1, li.MsoToc1, div.MsoToc1
 	{mso-style-update:auto;
 	mso-style-noshow:yes;
 	mso-style-next:Normal;
 	margin:0in;
 	margin-bottom:.0001pt;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:Verdana;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";}
 p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
 	{margin:0in;
 	margin-bottom:.0001pt;
 	text-align:center;
 	mso-pagination:widow-orphan;
 	font-size:12.0pt;
 	font-family:"Times New Roman";
 	mso-fareast-font-family:"Times New Roman";
 	font-weight:bold;}
 a:link, span.MsoHyperlink
 	{color:blue;
 	text-decoration:underline;
 	text-underline:single;}
 a:visited, span.MsoHyperlinkFollowed
 	{color:purple;
 	text-decoration:underline;
 	text-underline:single;}
 p
 	{mso-margin-top-alt:auto;
 	margin-right:0in;
 	mso-margin-bottom-alt:auto;
 	margin-left:0in;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:Verdana;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";}
 pre
 	{margin:0in;
 	margin-bottom:.0001pt;
 	text-align:left;
 	mso-pagination:widow-orphan;
 	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
 	font-size:10.0pt;
 	font-family:"Courier New";
 	mso-fareast-font-family:"Times New Roman";}
 tt
 	{font-family:"Arial Unicode MS";
 	mso-ascii-font-family:"Arial Unicode MS";
 	mso-fareast-font-family:"Arial Unicode MS";
 	mso-hansi-font-family:"Arial Unicode MS";
 	mso-bidi-font-family:"Courier New";}
 p.Text, li.Text, div.Text
 	{mso-style-name:"Text\,t";
 	mso-style-parent:"";
 	margin-top:0in;
 	margin-right:0in;
 	margin-bottom:6.0pt;
 	margin-left:0in;
 	text-align:left;
 	line-height:12.0pt;
 	mso-line-height-rule:exactly;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:"Times New Roman";
 	mso-fareast-font-family:"Times New Roman";
 	color:black;}
 span.normalarial1
 	{mso-style-name:normalarial1;
 	mso-ansi-font-size:10.0pt;
 	mso-bidi-font-size:10.0pt;
 	font-family:Arial;
 	mso-ascii-font-family:Arial;
 	mso-hansi-font-family:Arial;
 	mso-bidi-font-family:Arial;}
 p.Copyright, li.Copyright, div.Copyright
 	{mso-style-name:"Copyright\,copy";
 	mso-style-parent:"Text\,t";
 	margin-top:0in;
 	margin-right:-1.0in;
 	margin-bottom:6.0pt;
 	margin-left:0in;
 	text-align:left;
 	line-height:9.0pt;
 	mso-line-height-rule:exactly;
 	mso-pagination:widow-orphan;
 	font-size:8.0pt;
 	mso-bidi-font-size:10.0pt;
 	font-family:"Times New Roman";
 	mso-fareast-font-family:"Times New Roman";}
 p.DefaultText, li.DefaultText, div.DefaultText
 	{mso-style-name:"Default Text";
 	margin:0in;
 	margin-bottom:.0001pt;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:Verdana;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";}
 p.TableTextLarge, li.TableTextLarge, div.TableTextLarge
 	{mso-style-name:"Table Text Large";
 	margin:0in;
 	margin-bottom:.0001pt;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:Verdana;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";}
 p.TableHeader, li.TableHeader, div.TableHeader
 	{mso-style-name:"Table Header";
 	margin:0in;
 	margin-bottom:.0001pt;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:Arial;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";
 	font-weight:bold;
 	mso-bidi-font-weight:normal;}
 span.Heading1
 	{mso-style-name:"Heading 1\,Heading 1 Char Char\,Heading 1 Char1 Char";
 	mso-style-link:"Heading 1\,Heading 1 Char Char\,Heading 1 Char1";
 	mso-ansi-font-size:12.0pt;
 	font-family:Verdana;
 	mso-ascii-font-family:Verdana;
 	mso-hansi-font-family:Verdana;
 	mso-ansi-language:EN-US;
 	mso-fareast-language:EN-US;
 	mso-bidi-language:AR-SA;
 	font-weight:bold;
 	mso-bidi-font-weight:normal;}
 p.AppendixHeading3, li.AppendixHeading3, div.AppendixHeading3
 	{mso-style-name:"Appendix Heading 3";
 	mso-style-next:Normal;
 	margin-top:0in;
 	margin-right:0in;
 	margin-bottom:6.0pt;
 	margin-left:0in;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	page-break-after:avoid;
 	mso-outline-level:3;
 	background:#DFDFDF;
 	mso-shading:white;
 	mso-pattern:gray-125 auto;
 	font-size:12.0pt;
 	mso-bidi-font-size:10.0pt;
 	font-family:"Arial Bold";
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";
 	color:red;
 	font-weight:bold;
 	mso-bidi-font-weight:normal;}
 span.Hyperlink114
 	{mso-style-name:Hyperlink114;
 	color:#0033BB;
 	text-decoration:underline;
 	text-underline:single;}
 p.Heading1147, li.Heading1147, div.Heading1147
 	{mso-style-name:"Heading 1147";
 	margin-top:.2in;
 	margin-right:0in;
 	margin-bottom:6.0pt;
 	margin-left:0in;
 	text-align:left;
 	line-height:125%;
 	mso-pagination:widow-orphan;
 	mso-outline-level:2;
 	font-size:19.0pt;
 	font-family:"Times New Roman";
 	mso-fareast-font-family:"Times New Roman";
 	color:black;
 	mso-font-kerning:18.0pt;
 	font-weight:bold;}
 p.Heading4141, li.Heading4141, div.Heading4141
 	{mso-style-name:"Heading 4141";
 	margin-top:.2in;
 	margin-right:0in;
 	margin-bottom:6.0pt;
 	margin-left:0in;
 	text-align:left;
 	line-height:125%;
 	mso-pagination:widow-orphan;
 	mso-outline-level:5;
 	font-size:15.5pt;
 	font-family:"Times New Roman";
 	mso-fareast-font-family:"Times New Roman";
 	color:black;
 	font-weight:bold;}
 p.Heading6106, li.Heading6106, div.Heading6106
 	{mso-style-name:"Heading 6106";
 	margin-top:.2in;
 	margin-right:0in;
 	margin-bottom:6.0pt;
 	margin-left:0in;
 	text-align:left;
 	line-height:125%;
 	mso-pagination:widow-orphan;
 	mso-outline-level:7;
 	font-size:14.5pt;
 	font-family:"Times New Roman";
 	mso-fareast-font-family:"Times New Roman";
 	color:black;
 	font-weight:bold;}
 p.NormalWeb381, li.NormalWeb381, div.NormalWeb381
 	{mso-style-name:"Normal \(Web\)381";
 	margin-top:.1in;
 	margin-right:0in;
 	margin-bottom:.1in;
 	margin-left:0in;
 	text-align:left;
 	line-height:18.0pt;
 	mso-pagination:widow-orphan;
 	font-size:12.0pt;
 	font-family:"Times New Roman";
 	mso-fareast-font-family:"Times New Roman";
 	color:black;}
 span.Hyperlink115
 	{mso-style-name:Hyperlink115;
 	color:#0033CC;
 	font-weight:normal;
 	text-decoration:underline;
 	text-underline:single;}
 span.Heading2
 	{mso-style-name:"Heading 2\,Heading 2 Char Char";
 	mso-style-link:"Heading 2\,Heading 2 Char";
 	mso-ansi-font-size:11.0pt;
 	font-family:Verdana;
 	mso-ascii-font-family:Verdana;
 	mso-hansi-font-family:Verdana;
 	mso-ansi-language:EN-US;
 	mso-fareast-language:EN-US;
 	mso-bidi-language:AR-SA;
 	font-weight:bold;
 	mso-bidi-font-weight:normal;}
 p.Norma, li.Norma, div.Norma
 	{mso-style-name:Norma;
 	margin:0in;
 	margin-bottom:.0001pt;
 	text-align:left;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:Verdana;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";}
 p.Body-noindentChar, li.Body-noindentChar, div.Body-noindentChar
 	{mso-style-name:"Body-no indent Char";
 	mso-style-parent:"";
 	mso-style-link:"Body-no indent Char Char";
 	mso-style-next:Body-indent;
 	margin-top:6.0pt;
 	margin-right:-.7pt;
 	margin-bottom:0in;
 	margin-left:0in;
 	margin-bottom:.0001pt;
 	text-align:left;
 	line-height:14.0pt;
 	mso-line-height-rule:exactly;
 	mso-pagination:widow-orphan;
 	tab-stops:5.5in;
 	font-size:9.5pt;
 	mso-bidi-font-size:10.0pt;
 	font-family:Arial;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";
 	mso-bidi-language:HE;}
 p.Body-indent, li.Body-indent, div.Body-indent
 	{mso-style-name:Body-indent;
 	margin-top:0in;
 	margin-right:-.95pt;
 	margin-bottom:0in;
 	margin-left:0in;
 	margin-bottom:.0001pt;
 	text-align:left;
 	text-indent:12.0pt;
 	line-height:14.0pt;
 	mso-line-height-rule:exactly;
 	mso-pagination:none;
 	font-size:9.5pt;
 	mso-bidi-font-size:10.0pt;
 	font-family:Arial;
 	mso-fareast-font-family:"Times New Roman";
 	mso-bidi-font-family:"Times New Roman";
 	mso-bidi-language:HE;}
 span.Body-noindentCharChar
 	{mso-style-name:"Body-no indent Char Char";
 	mso-style-link:"Body-no indent Char";
 	mso-ansi-font-size:9.5pt;
 	font-family:Arial;
 	mso-ascii-font-family:Arial;
 	mso-hansi-font-family:Arial;
 	mso-ansi-language:EN-US;
 	mso-fareast-language:EN-US;
 	mso-bidi-language:HE;}
 span.tx1
 	{mso-style-name:tx1;
 	font-weight:bold;}
 @page Section1
 	{size:8.5in 11.0in;
 	margin:.5in 1.0in 1.0in 63.0pt;
 	mso-header-margin:.5in;
 	mso-footer-margin:.5in;
 	mso-header:url("Go%20Beyond%20the%20limits%20of%20ASP.NET%20Form_files/header.htm") h1;
 	mso-footer:url("Go%20Beyond%20the%20limits%20of%20ASP.NET%20Form_files/header.htm") f1;
 	mso-paper-source:0;}
 div.Section1
 	{page:Section1;}
 /* List Definitions */
 @list l0
 	{mso-list-id:-132;
 	mso-list-type:simple;
 	mso-list-template-ids:1680475472;}
 @list l0:level1
 	{mso-level-tab-stop:1.25in;
 	mso-level-number-position:left;
 	margin-left:1.25in;
 	text-indent:-.25in;}
 ol
 	{margin-bottom:0in;}
 ul
 	{margin-bottom:0in;}
 -->
 </style>
  <style>
 /* Style Definitions */
 table.MsoNormalTable
 	{mso-style-name:"Table Normal";
 	mso-tstyle-rowband-size:0;
 	mso-tstyle-colband-size:0;
 	mso-style-noshow:yes;
 	mso-style-parent:"";
 	mso-padding-alt:0in 5.4pt 0in 5.4pt;
 	mso-para-margin:0in;
 	mso-para-margin-bottom:.0001pt;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:"Times New Roman";}
 table.MsoTableList8
 	{mso-style-name:"Table List 8";
 	mso-tstyle-rowband-size:1;
 	mso-tstyle-colband-size:0;
 	border:solid black 1.0pt;
 	mso-border-alt:solid black .75pt;
 	mso-padding-alt:0in 5.4pt 0in 5.4pt;
 	mso-border-insidev:.75pt solid black;
 	mso-para-margin:0in;
 	mso-para-margin-bottom:.0001pt;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:"Times New Roman";}
 table.MsoTableList8FirstRow
 	{mso-style-name:"Table List 8";
 	mso-table-condition:first-row;
 	mso-tstyle-shading:white;
 	mso-tstyle-pattern:solid yellow;
 	mso-tstyle-border-bottom:.75pt solid black;
 	mso-tstyle-diagonal-down:0in none windowtext;
 	mso-tstyle-diagonal-up:0in none windowtext;
 	mso-ansi-font-weight:bold;
 	mso-bidi-font-weight:bold;
 	mso-ansi-font-style:italic;
 	mso-bidi-font-style:italic;}
 table.MsoTableList8LastRow
 	{mso-style-name:"Table List 8";
 	mso-table-condition:last-row;
 	mso-tstyle-border-top:.75pt solid black;
 	mso-tstyle-diagonal-down:0in none windowtext;
 	mso-tstyle-diagonal-up:0in none windowtext;
 	mso-ansi-font-weight:bold;
 	mso-bidi-font-weight:bold;}
 table.MsoTableList8FirstCol
 	{mso-style-name:"Table List 8";
 	mso-table-condition:first-column;
 	mso-tstyle-diagonal-down:0in none windowtext;
 	mso-tstyle-diagonal-up:0in none windowtext;
 	mso-ansi-font-weight:bold;
 	mso-bidi-font-weight:bold;}
 table.MsoTableList8LastCol
 	{mso-style-name:"Table List 8";
 	mso-table-condition:last-column;
 	mso-tstyle-diagonal-down:0in none windowtext;
 	mso-tstyle-diagonal-up:0in none windowtext;
 	mso-ansi-font-weight:bold;
 	mso-bidi-font-weight:bold;}
 table.MsoTableList8OddRow
 	{mso-style-name:"Table List 8";
 	mso-table-condition:odd-row;
 	mso-tstyle-shading:white;
 	mso-tstyle-pattern:gray-25 yellow;
 	mso-tstyle-diagonal-down:0in none windowtext;
 	mso-tstyle-diagonal-up:0in none windowtext;
 	color:windowtext;}
 table.MsoTableList8EvenRow
 	{mso-style-name:"Table List 8";
 	mso-table-condition:even-row;
 	mso-tstyle-shading:white;
 	mso-tstyle-pattern:gray-50 red;
 	mso-tstyle-diagonal-down:0in none windowtext;
 	mso-tstyle-diagonal-up:0in none windowtext;}
 table.MsoTableProfessional
 	{mso-style-name:"Table Professional";
 	mso-tstyle-rowband-size:0;
 	mso-tstyle-colband-size:0;
 	border:solid black 1.0pt;
 	mso-border-alt:solid black .75pt;
 	mso-padding-alt:0in 5.4pt 0in 5.4pt;
 	mso-border-insideh:.75pt solid black;
 	mso-border-insidev:.75pt solid black;
 	mso-para-margin:0in;
 	mso-para-margin-bottom:.0001pt;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:"Times New Roman";}
 table.MsoTableProfessionalFirstRow
 	{mso-style-name:"Table Professional";
 	mso-table-condition:first-row;
 	mso-tstyle-shading:white;
 	mso-tstyle-pattern:solid black;
 	mso-tstyle-diagonal-down:0in none windowtext;
 	mso-tstyle-diagonal-up:0in none windowtext;
 	color:windowtext;
 	mso-ansi-font-weight:bold;
 	mso-bidi-font-weight:bold;}
 table.MsoTableGrid
 	{mso-style-name:"Table Grid";
 	mso-tstyle-rowband-size:0;
 	mso-tstyle-colband-size:0;
 	border:solid windowtext 1.0pt;
 	mso-border-alt:solid windowtext .5pt;
 	mso-padding-alt:0in 5.4pt 0in 5.4pt;
 	mso-border-insideh:.5pt solid windowtext;
 	mso-border-insidev:.5pt solid windowtext;
 	mso-para-margin:0in;
 	mso-para-margin-bottom:.0001pt;
 	text-align:justify;
 	mso-pagination:widow-orphan;
 	font-size:10.0pt;
 	font-family:"Times New Roman";}
 </style>
 <div class=Section1>
<p class=MsoNormal align=center style='text-align:center'><span
 style='font-size:20.0pt;mso-bidi-font-size:12.0pt'>Go Beyond </span><span
 style='font-size:20.0pt;mso-bidi-font-family:Arial'>the limits of ASP.NET Form</span><span
 style='font-size:20.0pt;mso-bidi-font-size:12.0pt'> </span></p>
  <p class=MsoSubtitle> </p>
 <p class=MsoNormal style='margin-left:1.0in;mso-layout-grid-align:none;
 text-autospace:none'><span style='mso-bidi-font-size:12.0pt'> </span></p>
 <span style='font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Verdana;
 mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
 mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br
 clear=all style='mso-special-character:line-break;page-break-before:always'>
 </span>
 
 <h1 style='mso-list:l46 level1 lfo21'><span
 style='mso-fareast-font-family:Verdana;mso-bidi-font-family:Verdana'><span
 style='mso-list:Ignore'>1<span style='font:7.0pt "Times New Roman"'>        
 </span></span></span>Introduction</h1>
 <p class=MsoNormal align=left style='text-align:left'>One of the most common
 hitches that ASP developers encounter when they first approach ASP.NET is that
 managed Web applications must be written according to a single-form interface
 model.<span style='mso-spacerun:yes'> </span>In the <i style='mso-bidi-font-style:
 normal'>single form interface </i>model each page always posts to itself by
 default using the POST HTTP method. The HTTP method and the target frame of the
 post can be programmatically adjusted using ad hoc form properties—<i
 style='mso-bidi-font-style:normal'><span style='font-size:11.0pt;mso-bidi-font-size:
 10.0pt;font-family:"Courier New"'>Method</span></i> and <i style='mso-bidi-font-style:
 normal'><span style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:
 "Courier New"'>Target</span></i>. The final destination of the postback can't
 be changed in any way.</p>
 <p class=MsoNormal align=left style='text-align:left'>You can correlate the
 terminologies a <i style='mso-bidi-font-style:normal'><span style='font-family:
 "Courier New"'>single-form interface</span></i> to the single-document
 interface (SDI) and <i style='mso-bidi-font-style:normal'><span
 style='font-family:"Courier New"'>multiple-form interface</span></i> to the
 multiple-document interface (MDI) in client server.</p>
 <p class=MsoNormal align=left style='text-align:left'><span
 style='mso-spacerun:yes'> </span>In HTML and ASP programming, the form element
 (i.e., <  FORM  >) features the Action property that programmers use to
 redirect to another URL after clicking. In ASP.NET, server-side forms are
 rendered using a class named <i style='mso-bidi-font-style:normal'><span
 style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New"'>HtmlForm</span></i>
 under <i style='mso-bidi-font-style:normal'>S</i><i style='mso-bidi-font-style:
 normal'><span style='font-family:"Courier New"'>ystem.Web.UI.HtmlControls</span></i><span
 style='font-family:"Courier New"'> </span><span style='mso-bidi-font-family:
 "Courier New"'>Namespace</span>. This class doesn't provide the familiar Action
 property, nor does it supply an alternative property to perform the similar
 functionality. As a result, the <i style='mso-bidi-font-style:normal'>single
 form interface</i> model is so deep-rooted in ASP.NET that there's no way
 around it.</p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal>Following is the description found on MSDN regarding the
 limitation.</p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal>“<i style='mso-bidi-font-style:normal'><span
 style='font-family:Arial'>The <b>action</b> attribute is always set to the URL
 of the page itself. The <b>action</b> attribute cannot be changed; therefore,
 you can only post back to the page itself.” (ref: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconhtmlformcontrol.asp
 )</span></i></p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal> In general, renouncing multiple forms is not a big
 sacrifice. Multiple forms are sometimes useful, but probably not as frequently
 as you may think. A scenario in which you would find it helpful to use multiple
 forms is when you implement form-based functionality in a large number of
 pages—in search, login dialogs, getting current stock quote for example.</p>
 <p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt;mso-bidi-font-family:Arial'> </span></p>
 <p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt;mso-bidi-font-family:Arial'>This white paper
 is an attempt to illustrate the limitation of the ASP.NET Form control, which
 doesn’t provide the facility of submitting data to other pages or sites. </span></p>
 <p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt;mso-bidi-font-family:Arial'>Let’s consider a
 situation where </span></p>
 <p class=MsoNormal style='margin-left:.5in;text-indent:-.25in;mso-list:l51 level1 lfo125;
 tab-stops:list .5in;mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt;mso-fareast-font-family:Verdana;mso-bidi-font-family:
 Verdana'><span style='mso-list:Ignore'>a)<span style='font:7.0pt "Times New Roman"'>    
 </span></span></span><span style='mso-bidi-font-size:12.0pt;
 mso-bidi-font-family:Arial'>we want perform a search on google.com with search
 criteria from a asp.net Web Page<span style='mso-spacerun:yes'> </span></span></p>
 <p class=MsoNormal style='margin-left:.5in;text-indent:-.25in;mso-list:l51 level1 lfo125;
 tab-stops:list .5in;mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt;mso-fareast-font-family:Verdana;mso-bidi-font-family:
 Verdana'><span style='mso-list:Ignore'>b)<span style='font:7.0pt "Times New Roman"'>    
 </span></span></span><span style='mso-bidi-font-size:12.0pt;
 mso-bidi-font-family:Arial'>Or we want to look at current stock quote of a
 Company listed on NASDAQ or NYSE by submitting information from an ASP.NET web
 page.</span></p>
 <p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt'> </span></p>
 <p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt;mso-bidi-font-family:Arial'>We cannot fulfill
 above requisites in currently available UI related controls in asp.NET.</span></p>
 <p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt;font-family:Arial'> </span></p>
 <p class=MsoNormal><span style='mso-spacerun:yes'></span>My paper is
 concentrating on the aspects of providing the Action property to Server-side
 form object based on very own HtmlForm class itself which further can be
 extended to adopt multiple-form interface. </p>
 <p class=MsoNormal style='mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-bidi-font-size:12.0pt;font-family:Arial'> </span></p>
 <p class=MsoNormal align=left style='text-align:left;mso-layout-grid-align:
 none;text-autospace:none'><span style='mso-bidi-font-size:12.0pt'>You can look
 at the demo of the new implementation at
 http://enjoy.europe.webmatrixhosting.net/derivedform.aspx </span></p>
 <p class=MsoNormal> </p>
 <h1 style='mso-list:l46 level1 lfo21'><span
 style='mso-fareast-font-family:Verdana;mso-bidi-font-family:Verdana'><span
 style='mso-list:Ignore'>2<span style='font:7.0pt "Times New Roman"'>        
 </span></span></span>HtmlForm class: reviewed</h1>
 <p class=MsoNormal><span style='mso-spacerun:yes'> </span>Before going into
 further detail, lets look a little review on HtmlForm.</p>
 <p class=MsoNormal>The HtmlForm class derived from HtmlContainer class and
 implements the IAttributeAccessor interface. So, the base class (HtmlContainer)
 provides HtmlForm the ability to govern and contain the child controls; IAttributeAccessor
 interface provide the ability the read and write the attributes of opening tag
 (i.e., < FORM …..) itself. The HtmlForm class is not sealed and thus it is
 permissible for further inheritance as well as customization.</p>
 <p class=MsoNormal> </p>
 <h1 style='mso-list:l46 level1 lfo21'><span
 style='mso-fareast-font-family:Verdana;mso-bidi-font-family:Verdana'><span
 style='mso-list:Ignore'>3<span style='font:7.0pt "Times New Roman"'>        
 </span></span></span>CHtmlForm: a more powerful shape of HtmlForm for
 ASP.NET</h1>
 <p class=MsoNormal><span style='mso-spacerun:yes'> </span>While we reviewed
 HtmlForm class, we found a starting point to think for providing Action
 property to it, because <i style='mso-bidi-font-style:normal'>the HtmlForm
 class is not sealed and thus can be further inherited</i>. As like other .NET
 control, it also features a bunch of protected, overridable methods that you
 could exploit to customize the overall behavior. You can achieve this with the
 help of reflection. As we know that</p>
 <p class=MsoNormal><i style='mso-bidi-font-style:normal'><span
 style='font-family:"Courier New"'>Reflection allows you to access any property
 on an object, even though the property is marked protected, internal, or
 private.</span></i></p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal>Let us start the process of customization of HtmlForm;
 CHtmlForm is an inherited class from HtmlForm class under
 System.Web.UI.HtmlControls<span style='font-family:"Courier New"'> </span><span
 style='mso-bidi-font-family:"Courier New"'>Namespace. HtmlForm class provides 4
 protected as well as public methods; one of them is </span><i style='mso-bidi-font-style:
 normal'><span style='font-family:"Courier New"'>RenderAttributes</span></i><span
 style='mso-bidi-font-family:"Courier New"'> method. The purpose of this method
 is to provide user defined implementation of default rendering process. It has
 a parameter of the type </span><span style='font-family:"Courier New"'>HtmlTextWriter,
 </span><span style='mso-bidi-font-family:"Courier New"'>to render final values
 of all attributes like <i style='mso-bidi-font-style:normal'>Method, target,
 name, id,<b style='mso-bidi-font-weight:normal'> action</b></i> to the parent
 object; for our case, it is the page object</span><span style='font-family:
 "Courier New"'>.</span></p>
 <p class=MsoNormal><span style='mso-spacerun:yes'> </span>The HtmlTextwriter
 object formulated the a new A<i style='mso-bidi-font-style:normal'>ction</i>
 attribute by resolving the hidden <span style='font-family:"Courier New"'>GetActionAttribute</span><span
 style='mso-spacerun:yes'> </span>of HtmlForm object.</p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal> </p>
 <table class=MsoTableProfessional border=1 cellspacing=0 cellpadding=0
 width=547 style='width:5.7in;border-collapse:collapse;border:none;mso-border-alt:
 solid black .75pt;mso-yfti-tbllook:480;mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-border-insideh:.75pt solid black;mso-border-insidev:.75pt solid black'>
 <tr style='mso-yfti-irow:-1'>
 <td width=187 valign=top style='width:1.95in;border:solid black 1.0pt;
 mso-border-alt:solid black .75pt;background:black;color:white;mso-shading:white;
 mso-pattern:solid black;padding:0in 5.4pt 0in 5.4pt'>
 <p class=MsoNormal align=left style='text-align:left;mso-yfti-cnfc:1'><b>CHtmlForm
 Methods & properties </b></p>
 </td>
 <td width=360 valign=top style='width:3.75in;border:solid black 1.0pt;
 border-left:none;mso-border-left-alt:solid black .75pt;mso-border-alt:solid black .75pt;
 background:black;color:white;mso-pattern:solid black;padding:0in 5.4pt 0in 5.4pt'>
 <p class=MsoNormal style='mso-yfti-cnfc:1'><b><span
 style='mso-spacerun:yes'> </span>Description</b></p>
 </td>
 </tr>
 <tr style='mso-yfti-irow:0'>
 <td width=187 valign=top style='width:1.95in;border:solid black 1.0pt;
 border-top:none;mso-border-top-alt:solid black .75pt;mso-border-alt:solid black .75pt;
 padding:0in 5.4pt 0in 5.4pt'>
 <p class=MsoNormal align=left style='text-align:left'>Action (property)</p>
 </td>
 <td width=360 valign=top style='width:3.75in;border-top:none;border-left:
 none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
 mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
 mso-border-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
 <p class=MsoNormal><span class=tx1><span style='font-weight:normal;
 mso-bidi-font-weight:bold'>Gets or sets the target url of the form post.</span></span><b
 style='mso-bidi-font-weight:normal'></b></p>
 </td>
 </tr>
 <tr style='mso-yfti-irow:1'>
 <td width=187 valign=top style='width:1.95in;border:solid black 1.0pt;
 border-top:none;mso-border-top-alt:solid black .75pt;mso-border-alt:solid black .75pt;
 padding:0in 5.4pt 0in 5.4pt'>
 <p class=MsoNormal align=left style='text-align:left'><span style='mso-bidi-font-family:
 Arial'>RenderAttributes <span style='mso-spacerun:yes'> </span>(protected
 override)</span></p>
 </td>
 <td width=360 valign=top style='width:3.75in;border-top:none;border-left:
 none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
 mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
 mso-border-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
 <p class=MsoNormal><span class=tx1><span style='font-weight:normal;
 mso-bidi-font-weight:bold'>Overridden to render custom Action attribute The
 main purpose of the overriding is to grab the "action" attribute of
 the original form</span></span><b style='mso-bidi-font-weight:normal'></b></p>
 </td>
 </tr>
 <tr style='mso-yfti-irow:2;mso-yfti-lastrow:yes'>
 <td width=187 valign=top style='width:1.95in;border:solid black 1.0pt;
 border-top:none;mso-border-top-alt:solid black .75pt;mso-border-alt:solid black .75pt;
 padding:0in 5.4pt 0in 5.4pt'>
 <p class=MsoNormal align=left style='text-align:left'><span style='mso-bidi-font-family:
 "Courier New"'>GetBaseObjectActionAttribute (private)</span></p>
 </td>
 <td width=360 valign=top style='width:3.75in;border-top:none;border-left:
 none;border-bottom:solid black 1.0pt;border-right:solid black 1.0pt;
 mso-border-top-alt:solid black .75pt;mso-border-left-alt:solid black .75pt;
 mso-border-alt:solid black .75pt;padding:0in 5.4pt 0in 5.4pt'>
 <p class=MsoNormal><span style='mso-bidi-font-family:"Courier New"'>Returns
 the normal action attribute of a server form.</span></p>
 </td>
 </tr>
 </table>
 <p class=MsoNormal><b> </b></p>
 <p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'><b
 style='mso-bidi-font-weight:normal'>Table 1 – CHtmlForm Class & its
 attributes </b></p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal align=left style='text-align:left'>Following code snippet
 shows the how final structure of a page will look like:</p>
 <p class=MsoNormal align=left style='text-align:left'> </p>
 <p class=AppendixHeading3 align=left style='text-align:left'><span style='mso-bookmark:_Toc67303206'><span
 style='font-size:8.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
 mso-bidi-font-family:"Times New Roman";color:windowtext;font-weight:normal'><%@
 Register TagPrefix="dtform"
 Namespace="DerivedTool.WebControls" Assembly="DerivedTool.WebControls.HtmlForm"
 %></span></span><span style='font-size:8.0pt;mso-bidi-font-size:10.0pt;
 font-family:"Courier New";mso-bidi-font-family:"Times New Roman";color:windowtext;
 font-weight:normal'></span></p>
 <p class=AppendixHeading3 align=left style='text-align:left'><span
 style='font-size:8.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
 mso-bidi-font-family:"Times New Roman";color:windowtext;font-weight:normal'><span
 style='mso-tab-count:1'></span><span style='mso-bookmark:_Toc67303207'><dtform:CHtmlForm
 Action="some_other_page.aspx" runat="server"></span></span></p>
 <p class=AppendixHeading3 align=left style='text-align:left'><span
 style='font-size:8.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
 mso-bidi-font-family:"Times New Roman";color:windowtext;font-weight:normal'><span
 style='mso-tab-count:2'> </span><span style='mso-bookmark:_Toc67303208'><asp:TextBox
 id="symbols" runat="server" value=></asp:TextBox></span></span></p>
 <p class=AppendixHeading3 align=left style='text-align:left'><span
 style='font-size:8.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
 mso-bidi-font-family:"Times New Roman";color:windowtext;font-weight:normal'><span
 style='mso-tab-count:2'> </span><span style='mso-bookmark:_Toc67303209'><asp:Button
 runat="server" Text="check Quote" /></span></span></p>
 <p class=AppendixHeading3 align=left style='text-align:left'><span
 style='font-size:8.0pt;mso-bidi-font-size:10.0pt;font-family:"Courier New";
 mso-bidi-font-family:"Times New Roman";color:windowtext;font-weight:normal'><span
 style='mso-tab-count:1'></span><span style='mso-bookmark:_Toc67303210'></dtform:CHtmlForm></span> </span><span
 style='mso-bookmark:_Toc67303210'></span><span style='mso-bookmark:_Toc67297608'></span></p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal> </p>
 <p class=MsoNormal> </p>
 <h1><span style='mso-fareast-font-family:
 Verdana;mso-bidi-font-family:Verdana'><span style='mso-list:Ignore'>4<span
 style='font:7.0pt "Times New Roman"'>        
 </span></span></span>Instruction to Deploy<span
 style='mso-spacerun:yes'> </span></h1>
 <p class=MsoNormal style='margin-left:.3in;mso-layout-grid-align:none;
 text-autospace:none'>Though deployment of this server–side control is very easy
 and simple, I am providing following the steps to test the control with asp.net</p>
 <p class=MsoNormal style='margin-left:.55in;text-indent:-.25in;mso-list:l53 level1 lfo126;
 tab-stops:list .55in;mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-fareast-font-family:Verdana;mso-bidi-font-family:Verdana'><span
 style='mso-list:Ignore'>a)<span style='font:7.0pt "Times New Roman"'>    
 </span></span></span>Extract all the files in the zip file to a
 folder say c:\deriveForm</p>
 <p class=MsoNormal style='margin-left:.55in;text-indent:-.25in;mso-list:l53 level1 lfo126;
 tab-stops:list .55in;mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-fareast-font-family:Verdana;mso-bidi-font-family:Verdana'><span
 style='mso-list:Ignore'>b)<span style='font:7.0pt "Times New Roman"'>    
 </span></span></span>Make “C:\deriveform” as a Virutal directory by
 giving name as “derivedemo”, if you have IIS server installed on your machine,
 other wise put the folder on a machine having IIS installed in it.</p>
 <p class=MsoNormal align=left><span>c)<span
 style='font:7.0pt "Times New Roman"'>     </span></span></span>Make
 a folder named “bin” under C:\deriveform and copy DerivedTool.WebControls.HtmlForm.dll
 to this new folder</p>
 <p class=MsoNormal align=left style='margin-left:.55in;text-align:left;
 text-indent:-.25in;mso-list:l53 level1 lfo126;tab-stops:list .55in;mso-layout-grid-align:
 none;text-autospace:none'><span style='mso-fareast-font-family:
 Verdana;mso-bidi-font-family:Verdana'><span style='mso-list:Ignore'>d)<span
 style='font:7.0pt "Times New Roman"'>     </span></span></span>Open
 your browser and navigate to http://localhost/derivedemo/derivedForm.aspx </p>
 <p class=MsoNormal align=left style='margin-left:.3in;text-align:left;
 mso-layout-grid-align:none;text-autospace:none'><span
 style='mso-spacerun:yes'> </span>Or navigate to http://<SERVER>/derivedemo/derivedForm.aspx
 if you don’t have IIS on the current machine.<span style='mso-spacerun:yes'> 
 </span></p>
 </div>
Original Comments (3)
Recovered from Wayback Machine