home *** CD-ROM | disk | FTP | other *** search
- <%@ Register TagPrefix="Acme" TagName="SourceRef" Src="/quickstart/util/SrcRef.aspx"%>
-
- <!-- #include virtual="/quickstart/aspplus/include/header.inc" -->
-
- <h4>Working with Server Controls</h4>
- <p>
-
- <div class="indent" style="font-family:Verdana; font-size:8pt;">
- <b> <img align="middle" src="/quickstart/images/bullet.gif"> </b><a class="toc2" target="content" href="#declaring">Declaring Server Controls</a><br>
- <b> <img align="middle" src="/quickstart/images/bullet.gif"> </b><a class="toc2" target="content" href="#manipulating">Manipulating Server Controls</a><br>
- <b> <img align="middle" src="/quickstart/images/bullet.gif"> </b><a class="toc2" target="content" href="#handling">Handling Control Action Events</a><br>
- <b> <img align="middle" src="/quickstart/images/bullet.gif"> </b><a class="toc2" target="content" href="#multiple">Handling Multiple Control Action Events</a><br>
- <b> <img align="middle" src="/quickstart/images/bullet.gif"> </b><a class="toc2" target="content" href="#navigation1">Performing Page Navigation (Scenario 1)</a><br>
- <b> <img align="middle" src="/quickstart/images/bullet.gif"> </b><a class="toc2" target="content" href="#navigation2">Performing Page Navigation (Scenario 2)</a><br>
- </div>
- <p>
-
- <hr>
-
- This section of the quickstart illustrates some common core concepts/actions
- performed by end-users when using ASP+ Server Controls within a page.
-
- <!--BEGIN SECTION-->
- <br>
- <a name="declaring">
- <br>
- <span class="subhead">Declaring Server Controls</span>
- <p>
-
- ASP+ Server Controls are identified within a page using declarative tags
- that contain a <b>runat="server"</b> attribute. The below example declares three
- <asp:label runat="server"> server controls -- customizing the text and
- style properties of each one individually.
-
- <p>
-
- <Acme:SourceRef
- RunSample="/quickstart/aspplus/samples/webforms/controls/controls1.aspx"
- ViewSource="/quickstart/aspplus/samples/webforms/controls/controls1.src"
- Icon="/quickstart/aspplus/images/controls1.gif"
- Caption="Controls1.aspx"
- runat="server" />
-
- <!--BEGIN SECTION-->
- <br>
- <a name="manipulating">
- <br>
- <span class="subhead">Manipulating Server Controls</span>
- <p>
-
- An individual ASP+ Server Control can be programmatically identified
- within a page by providing it with an <b>id</b> attribute. Page developers
- can use this id reference to programmatically manipulate the server control's
- object model at runtime. For example, the below example demonstrates how a page
- developer could programmatically set a <asp:label runat="server"> control's
- "text" property" within the <b>Page_Load</b> event:
-
- <p>
-
- <Acme:SourceRef
- RunSample="/quickstart/aspplus/samples/webforms/controls/controls2.aspx"
- ViewSource="/quickstart/aspplus/samples/webforms/controls/controls2.src"
- Icon="/quickstart/aspplus/images/controls2.gif"
- Caption="Controls2.aspx"
- runat="server" />
-
- <!--BEGIN SECTION-->
- <br>
- <a name="handling">
- <br>
- <span class="subhead">Handling Control Action Events</span>
- <p>
-
- ASP+ Server Controls may optionally expose and raise <b>server events</b> that
- can be handled by page developers. A page developer may accomplish this
- by declaratively wiring up an <b>event handler</b> on a control (where the attribute
- name of a event wireup indicates the event name and the attribute value
- indicates the name of a method to call). For example, the below code
- example demonstrates how to wire-up an <b>OnClick</b> event on a button control:
-
- <p>
-
- <Acme:SourceRef
- RunSample="/quickstart/aspplus/samples/webforms/controls/controls3.aspx"
- ViewSource="/quickstart/aspplus/samples/webforms/controls/controls3.src"
- Icon="/quickstart/aspplus/images/controls3.gif"
- Caption="Controls3.aspx"
- runat="server" />
-
-
- <!--BEGIN SECTION-->
- <br>
- <a name="multiple">
- <br>
- <span class="subhead">Handling Multiple Control Action Events</span>
- <p>
-
-
- Event handlers provide a clean way for page developers to structure logic
- within an ASP+ Page. For example, the below sample demonstrates how to
- wire-up and handle 4 button events on a page:
-
- <p>
-
- <Acme:SourceRef
- RunSample="/quickstart/aspplus/samples/webforms/controls/controls4.aspx"
- ViewSource="/quickstart/aspplus/samples/webforms/controls/controls4.src"
- Icon="/quickstart/aspplus/images/controls4.gif"
- Caption="Controls4.aspx"
- runat="server" />
-
-
- <!--BEGIN SECTION-->
- <br>
- <a name="navigation1">
- <br>
- <span class="subhead">Performing Page Navigation (Scenario 1)</span>
- <p>
-
- Page navigation amongst multiple pages is a common scenario in virtually
- all web applications. The below sample demonstrates how ASP+ Page developers
- can utilize the <asp:hyperlink runat=server> control to navigate
- to another page (passing custom querystring parameters along the way). The
- sample then demonstrates how ASP+ Page developers can easily get access to these
- querystring parameters from the target page.
-
- <p>
-
- <Acme:SourceRef
- RunSample="/quickstart/aspplus/samples/webforms/controls/controls5.aspx"
- ViewSource="/quickstart/aspplus/samples/webforms/controls/controls5.src"
- Icon="/quickstart/aspplus/images/controls5.gif"
- Caption="Controls5.aspx"
- runat="server" />
-
-
- <!--BEGIN SECTION-->
- <br>
- <a name="navigation2">
- <br>
- <span class="subhead">Performing Page Navigation (Scenario 2)</span>
- <p>
-
-
- Not all Page navigation scenarios are initiated via hyperlinks on the client.
- Client-side page redirects/navigations can also be initiated from the
- server by an ASP+ Page developer by calling the <b>Page.Navigate(url)</b> method.
- This is typically done when server-side validation is required on some client
- input prior to the navigation actually taking place.
-
- <p>The below sample demonstrates how a developer can utilize the <b>Page.Navigate</b>
- method to pass paramters off to another target page. It also demonstrates how ASP+
- Page developers can easily get access to these parameters from the target
- page.
-
- <p>
-
- <Acme:SourceRef
- RunSample="/quickstart/aspplus/samples/webforms/controls/controls6.aspx"
- ViewSource="/quickstart/aspplus/samples/webforms/controls/controls6.src"
- Icon="/quickstart/aspplus/images/controls6.gif"
- Caption="Controls6.aspx"
- runat="server" />
-
- <!-- #include virtual="/quickstart/aspplus/include/footer.inc" -->