DynamicButton Properties
The DynamicButton, which derives from the ImageButton, has the following properties in addtion to, or modified from, the ImageButton properties:
- ButtonText (Required): This is the text to be displayed on the buttonface;
- Button (Optional): The name of an existing button in .png format in the button directory (cannot contain text) to be used as the basis for the button (the size of the button will not change, therefor, the button must be large enough to contain the text;
- Icon (Optional): The name of an icon in .png format in the icon directory that will be included with the button. This will set the button length to a fixed value of 140 pixels (if the button text will fit, otherwise it will be stretched accordingly);
- Reverse: if set true, will place the icon (if specified) on the right side of the button, and will write the button text from right to left;
- Length (Optional): if specified, indicates the button length. (accepts an integer that specifies the number of pixels);
- ImageUrl: inherited from the ImageButton. Not to be Used.
- SkinID: inherited from the ImageButton. Not to be Used.
- ThemeName (Optional): overrides the mechanism that retrieves the themename of the page in which the DynamicButton is embedded. This allows you to specify a theme even if not used, and use the corresponding file structures to create DynamicButtons.
|
Sample Page
To illustrate the use of the DynamicButton see the code of a very simple page "Deafult2.aspx" that contains two DynamicButtons that don't do anything since no properties have been set and no actions have been specified for the click event:
|
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <%@ Register Assembly="ArnoldusLib" Namespace="ArnoldusLib" TagPrefix="arn" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title> Sample Page </title> </head> <body> <form id="form1" runat="server"> <div> <br /> <br /> <arn:DynamicButton ID="DynamicButton1" runat="server" ButtonText="Add" Icon="Admin" /> <br /> <br /> <arn:DynamicButton ID="DynamicButton2" runat="server" ButtonText="New Button" Icon="Admin" /> </div> </form> </body> </html>
|
|
N.B.: This Page was used to illustrate the restrictions (in Design View) when a button has/has not been created.
Property List
The following picture shows the complete property list (split into two parts) as seen in VS2008:
|
|
|
|
As you can see, the ImageButton properties are all there, while the DynamicButton additonal properties are listed under the Misc. header.
To add a DynamicButton to the page, drag it from the toolbar to page. In DesignView a button with the text "DynamicButton" will be created. The following line is added near the beginning of the page:
<%@ Register Assembly="ArnoldusLib" Namespace="ArnoldusLib" TagPrefix="arn" %>
However, the "ButtonText" property will be null. You must set the ButtonText to a value for the button to work.
Note that the ButtonText property can be bound to some other field: ButtonText='<%# Eval("Title") %>'
|
|
Installation
To install the ArnoldusLib controls for use with Visual Studio do the following:
Unzip the library to a directory on your hard disk. You can choose any directory of your liking, but choosing the directory “My Documents\Visual Studio 2008\Projects\” will simplify the inclusion in the Visual Studio 2008 toolbar. Use the “Choose Toolbox Items...” sub-menu item from the “Tools” menu of Visual Studio 2008 and click the “Browse” button on the “.NET Framework Components” Tab. The “Look in:” section contains the “Desktop”, “My Projects” and “My Computer” icons. Navigate to the directory to which you unzipped the files and click on “ArnoldusLib.dll”. The controls will now appear in the toolbar and can be used like any other web control. If you use the control often, you can add the following section to the “web.config”, under the section: <system.web>. This prevents that you have to register the ArnoldusLib library on every page:
|
|
<pages>
<controls>
<addtagPrefix="arn" namespace="ArnoldusLib" assembly="ArnoldusLib" />
</controls>
</pages>
|