Introduction to EktronCMS400.NET Server Controls Ektron.Cms.Controls.Search MySearch = new Ektron.Cms.Controls.Search(); MySearch.Page = this; MySearch.Fill(); This relationship is only required when inserting a control in the code behind. When dragging and dropping, even if you make changes in code behind, the relationship is automatically generated. Best Practice Ektron recommends including the page property reference when using the server controls as components in the code behind. Customizing Server Controls One of Visual Studio .NET’s strengths is its separation of coding and logic from presentation. Web page formatting is handled by a page’s HTML, while the logic is handled by the code behind, which is stored in the corresponding .vb file. For example, if the ASP.NET page is mypage.aspx, the code behind file is mypage.aspx.vb. NOTE If you do not see the code behind files, click the Show All Files button on the VS .NET Solution Explorer toolbar. Within the vb file, you can use Visual Basic to insert code to manipulate the events that occur on the page. This subsection contains the following topics: • ”Recognizing the Server Control Within the HTML” on page 49 • ”Recognizing the Server Control Within the Code Behind” on page 49 • ”Customizing the Server Control in the Code Behind” on page 50 EktronCMS400.NETDeveloperReferenceManual, Version 5.0, Revision 8 48
Introduction to EktronCMS400.NET Server Controls • ”Troubleshooting Error Creating Control Message” on page 50 Recognizing the Server Control Within the HTML Within a Web page’s HTML, a tag wraps the VS. NET object, as shown below. Above is an example of a Search Server Control. Below is an example of a ContentBlock Server Control.