The C1Button control can be used as a substitute for the standard ASP.NET button control. In the following example, we will demonstrate the client-side Click event by adding a Click event handler that writes text to a label when the event is fired. This topic assumes that you have created an AJAX-enabled ASP.NET project that contains a ScriptManager control (see Creating an AJAX-Enabled ASP.NET Project).
Complete the following steps:
1. Place your cursor between the <form> and </form> tags.
2. From the Toolbox, add a standard Label control to your project.
3. From the Toolbox, add a C1Button control to your project.
4. Click the Split tab to enter Split view.
5. Right-click the C1Button control to display its context menu and then select Properties from the list to reveal its list of properties in the Properties window.
6. In the Properties window, complete the following:
a. Set the Text property to "Show Event".
b. Set the AutoPostBack property to True.
c.
Click the Events button to reveal
C1Button's
list of events.
d. Double-click the Click event to add the event handler to Code view. This will also set C1Button's OnClick property to "C1Button1_Click", which is the default name of the event handler.
7. In Code view, add the following code to the C1Button1_Click event:
Label1.Text = "The Click event has been fired."
•C#
Label1.Text = "The Click event has been fired.";
8. Open the project and click the button. The label's text will change to "The Click event has been fired."