home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / aspplus / doc / webserverctrls.aspx < prev    next >
Encoding:
Text File  |  2000-05-25  |  6.3 KB  |  165 lines

  1. <%@ Register TagPrefix="Acme" TagName="SourceRef" Src="/quickstart/util/SrcRef.aspx"%>
  2.  
  3. <!-- #include virtual="/quickstart/aspplus/include/header.inc" -->
  4.  
  5. <h4>Working with Server Controls</h4>
  6. <p>
  7.  
  8. <div class="indent" style="font-family:Verdana; font-size:8pt;">
  9.     <b> <img align="middle" src="/quickstart/images/bullet.gif">  </b><a class="toc2" target="content" href="#declaring">Declaring Server Controls</a><br>
  10.     <b> <img align="middle" src="/quickstart/images/bullet.gif">  </b><a class="toc2" target="content" href="#manipulating">Manipulating Server Controls</a><br>
  11.     <b> <img align="middle" src="/quickstart/images/bullet.gif">  </b><a class="toc2" target="content" href="#handling">Handling Control Action Events</a><br>
  12.     <b> <img align="middle" src="/quickstart/images/bullet.gif">  </b><a class="toc2" target="content" href="#multiple">Handling Multiple Control Action Events</a><br>
  13.     <b> <img align="middle" src="/quickstart/images/bullet.gif">  </b><a class="toc2" target="content" href="#navigation1">Performing Page Navigation (Scenario 1)</a><br>
  14.     <b> <img align="middle" src="/quickstart/images/bullet.gif">  </b><a class="toc2" target="content" href="#navigation2">Performing Page Navigation (Scenario 2)</a><br>
  15. </div>
  16. <p>
  17.  
  18. <hr>
  19.  
  20. This section of the quickstart illustrates some common core concepts/actions
  21. performed by end-users when using ASP+ Server Controls within a page.
  22.  
  23. <!--BEGIN SECTION-->
  24. <br>
  25. <a name="declaring">
  26. <br>
  27. <span class="subhead">Declaring Server Controls</span>
  28. <p>
  29.  
  30. ASP+ Server Controls are identified within a page using declarative tags
  31. that contain a <b>runat="server"</b> attribute.  The below example declares three
  32. <asp:label runat="server"> server controls -- customizing the text and
  33. style properties of each one individually.
  34.  
  35. <p>
  36.  
  37. <Acme:SourceRef
  38.   RunSample="/quickstart/aspplus/samples/webforms/controls/controls1.aspx"
  39.   ViewSource="/quickstart/aspplus/samples/webforms/controls/controls1.src"
  40.   Icon="/quickstart/aspplus/images/controls1.gif"
  41.   Caption="Controls1.aspx"
  42.   runat="server" />
  43.  
  44. <!--BEGIN SECTION-->
  45. <br>
  46. <a name="manipulating">
  47. <br>
  48. <span class="subhead">Manipulating Server Controls</span>
  49. <p>
  50.  
  51. An individual ASP+ Server Control can be programmatically identified 
  52. within a page by providing it with an <b>id</b> attribute.  Page developers
  53. can use this id reference to programmatically manipulate the server control's
  54. object model at runtime.  For example, the below example demonstrates how a page
  55. developer could programmatically set a <asp:label runat="server"> control's 
  56. "text" property" within the <b>Page_Load</b> event:
  57.  
  58. <p>
  59.  
  60. <Acme:SourceRef
  61.   RunSample="/quickstart/aspplus/samples/webforms/controls/controls2.aspx"
  62.   ViewSource="/quickstart/aspplus/samples/webforms/controls/controls2.src"
  63.   Icon="/quickstart/aspplus/images/controls2.gif"
  64.   Caption="Controls2.aspx"
  65.   runat="server" />
  66.  
  67. <!--BEGIN SECTION-->
  68. <br>
  69. <a name="handling">
  70. <br>
  71. <span class="subhead">Handling Control Action Events</span>
  72. <p>
  73.  
  74. ASP+ Server Controls may optionally expose and raise <b>server events</b> that
  75. can be handled by page developers.  A page developer may accomplish this
  76. by declaratively wiring up an <b>event handler</b> on a control (where the attribute
  77. name of a event wireup indicates the event name and the attribute value
  78. indicates the name of a method to call).  For example, the below code
  79. example demonstrates how to wire-up an <b>OnClick</b> event on a button control:
  80.  
  81. <p>
  82.  
  83. <Acme:SourceRef
  84.   RunSample="/quickstart/aspplus/samples/webforms/controls/controls3.aspx"
  85.   ViewSource="/quickstart/aspplus/samples/webforms/controls/controls3.src"
  86.   Icon="/quickstart/aspplus/images/controls3.gif"
  87.   Caption="Controls3.aspx"
  88.   runat="server" />
  89.  
  90.  
  91. <!--BEGIN SECTION-->
  92. <br>
  93. <a name="multiple">
  94. <br>
  95. <span class="subhead">Handling Multiple Control Action Events</span>
  96. <p>
  97.  
  98.  
  99. Event handlers provide a clean way for page developers to structure logic 
  100. within an ASP+ Page.  For example, the below sample demonstrates how to
  101. wire-up and handle 4 button events on a page:
  102.  
  103. <p>
  104.  
  105. <Acme:SourceRef
  106.   RunSample="/quickstart/aspplus/samples/webforms/controls/controls4.aspx"
  107.   ViewSource="/quickstart/aspplus/samples/webforms/controls/controls4.src"
  108.   Icon="/quickstart/aspplus/images/controls4.gif"
  109.   Caption="Controls4.aspx"
  110.   runat="server" />
  111.  
  112.  
  113. <!--BEGIN SECTION-->
  114. <br>
  115. <a name="navigation1">
  116. <br>
  117. <span class="subhead">Performing Page Navigation (Scenario 1)</span>
  118. <p>
  119.  
  120. Page navigation amongst multiple pages is a common scenario in virtually 
  121. all web applications.  The below sample demonstrates how ASP+ Page developers
  122. can utilize the <asp:hyperlink runat=server> control to navigate 
  123. to another page (passing custom querystring parameters along the way).  The
  124. sample then demonstrates how ASP+ Page developers can easily get access to these
  125. querystring parameters from the target page.
  126.  
  127. <p>
  128.  
  129. <Acme:SourceRef
  130.   RunSample="/quickstart/aspplus/samples/webforms/controls/controls5.aspx"
  131.   ViewSource="/quickstart/aspplus/samples/webforms/controls/controls5.src"
  132.   Icon="/quickstart/aspplus/images/controls5.gif"
  133.   Caption="Controls5.aspx"
  134.   runat="server" />
  135.  
  136.  
  137. <!--BEGIN SECTION-->
  138. <br>
  139. <a name="navigation2">
  140. <br>
  141. <span class="subhead">Performing Page Navigation (Scenario 2)</span>
  142. <p>
  143.  
  144.  
  145. Not all Page navigation scenarios are initiated via hyperlinks on the client.
  146. Client-side page redirects/navigations can also be initiated from the
  147. server by an ASP+ Page developer by calling the <b>Page.Navigate(url)</b> method.
  148. This is typically done when server-side validation is required on some client 
  149. input prior to the navigation actually taking place.
  150.  
  151. <p>The below sample demonstrates how a developer can utilize the <b>Page.Navigate</b>
  152.  method to pass paramters off to another target page.  It also demonstrates how ASP+
  153. Page developers can easily get access to these parameters from the target
  154. page.  
  155.  
  156. <p>
  157.  
  158. <Acme:SourceRef
  159.   RunSample="/quickstart/aspplus/samples/webforms/controls/controls6.aspx"
  160.   ViewSource="/quickstart/aspplus/samples/webforms/controls/controls6.src"
  161.   Icon="/quickstart/aspplus/images/controls6.gif"
  162.   Caption="Controls6.aspx"
  163.   runat="server" />
  164.  
  165. <!-- #include virtual="/quickstart/aspplus/include/footer.inc" -->