ComponentOne Expander for ASP.NET AJAX: Expander for ASP.NET AJAX Task-Based Help > Suppressing Header Post Back

Suppressing Header Post Back

You can easily set whether or not the header of the C1Expander automatically posts back to the server by using the SuppressHeaderPostbacks property. By default the SuppressHeaderPostbacks property is set to False and any client-size click handlers in the header are not suppressed; to suppress client-size click handlers in the header of a C1Expander, set SuppressHeaderPostbacks to True.

In this topic you'll create two C1Expanders with hyperlinks in the header area, one C1Expander with SuppressHeaderPostbacks set to True and one by default with SuppressHeaderPostbacks set to False.

Complete the following steps:

1.   Select Layout | Inset Table and in the Insert Table dialog box create a table with one row and two columns.

Your page should now look similar to the following:

 

 

2.   Click within the left cell of the table and in the Visual Studio Toolbox double-click the C1Expander to add the control to the left cell.

3.   Click within the right cell of the table and in the Visual Studio Toolbox double-click the C1Expander to add the control to the right cell.

The page should now look similar to the following:

 

 

4.   Delete the default "Header" text within each C1Expander's header and from the Toolbox add a HyperLink control to each header.

5.   Select each HyperLink control and set the following properties in the Properties window:

      Set both the HyperLink controls' NavigateUrl properties to "http://www.componentone.com/".

      Set both the HyperLink controls' Target properties to "_blank".

      Set the left-side HyperLink control's Text property to "Suppressed".

      Set the right-side HyperLink control's Text property to "Unsuppressed".

The page will now look similar to the following:

 

 

6.   Select the left C1Expander and in the Properties window set its SuppressHeaderPostbacks property to True.

By default the right-side C1Expander's SuppressHeaderPostbacks property will remain set to False.

Run your application and observe:

1.   Click the hyperlink in the left C1Expander's header. The hyperlink does not open.

Note that you can right-click the link to manually open the Web site, but because the SuppressHeaderPostbacks property was set to True, client-size click handlers in the header of the C1Expander were suppressed.

2.   Click the hyperlink in the right C1Expander's header. The hyperlink opens the ComponentOne Web site in a new page as expected.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.