When developing an ASP.NET application with
BDS® 2006 the Web Controls allow you to create code and control events to manage the flow of your application. The interaction with HTML elements via code is not as obvious, but is possible. Placing an HTML Div HTML Element on an ASP.NET Web Application page results in the following page code:
<div>Div</div>
Change the code to look something like:
<div runat="server" id="divarea"></div>
Declare a strict protected variable for your
‘divarea’ in your webform class. The variable name should match the
id you give your element.
strict protected
divarea: System.Web.UI.HtmlControls.HtmlGenericControl;
Your HTML Element is now accessible in you
codebehind page. You have access to the controls properties and can do something like the following in your code to change the text of the
‘divarea’:
divarea.InnerHtml:= ‘This is a HTML Div Element’;
Putting this together with the information in a
previous post I created a
‘blogroll’ page that displays the most recent 5 posts from a few feeds I monitor.
BDS® 2006 truly simplifies
ASP.NET.
Labels: ASP.NET, Code, Delphi