MultiView::SwitchViewByIDCommandName Field

 

Represents the command name associated with changing the active View control in a MultiView control, based on a specified View id. This field is read-only.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
static initonly String^ SwitchViewByIDCommandName

Field Value

Type: System::String^

Use the SwitchViewByIDCommandName field to represent the "SwitchViewByID" command name.

You can use the value of this field to take advantage of the MultiView control's automatic updating of the active View control. For example, if a View control contains a Button control that navigates to the first View when clicked, you can set the CommandName property to the value of the SwitchViewByIDCommandName field, which is "SwitchViewByID". Set the CommandArgument property to the ID of the first View in the MultiView control, such as "Page1". This causes the MultiView control to automatically set "Page1" as the active View when the button is clicked.

The following code example demonstrates how to use a MultiView control to create a basic survey. Each View control is a separate survey question. The PreviousViewCommandName and NextViewCommandName fields are used to provide automatic navigation between the previous and next View controls in the survey. If the user clicks the Retake Survey button in the last View of the survey, the SwitchViewByIDCommandName field is used along with a command argument of "Page1" to redirect the user back to the first View of the survey.

System_CAPS_noteNote

The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Forms Page Code Model.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: