Controls You Can Use on Web Forms ASP.NET IE WebControls MultiPage WebControl
In certain cases, you may need to obtain information from a data source and present the data into multiple pages.
The MultiPage and PageView controls by themselves cannot be bound to a data source. But when a MultiPage is declared within the ItemTemplate of a data control, such as a FormView or DataList control, the HTML and controls within each of the PageView objects can be bound to the parent control’s data source, using the same databinding techniques that apply to any other ASP.NET control.
Let us briefly explore how that is done.
- The procedure for adding a MultiPage within a data control is basically the same as adding a standalone MultiPage, except that the control must be defined within the ItemTemplate of the parent control, in this case a FormView control.
<formview runat="server">
<itemtemplate>
<ie:multipage id="multipage1" runat="server">
... individual pageviews markup goes here ...
</ie:multipage>
</itemtemplate>
</formview>
- In this example, the interface for page navigation is done via <
asp:linkbutton
> controls defined in the SelectedItemTemplate of the DataList control that is used for record selection.
<selecteditemtemplate>
... some code omitted for clarity ...
<asp:linkbutton runat="server"
text="Personal Info"
commandname="personalInfo"
style="font-size:9pt" />
|
<asp:linkbutton runat="server"
text="Sales Info"
commandname="salesInfo"
style="font-size:9pt" />
</selecteditemtemplate>
- The code for navigating the MultiPage invokes the Activate method of the PageView objects in the ItemCommand event handler of the DataList.
void getEmpInfo ( object src, DataListCommandEventArgs e ) {
... some code omitted for clarity ...
switch ( e.CommandName ) {
case "personalInfo" :
PageView personalInfo = ( PageView ) fvEmp.FindControl ( "personalInfo" );
personalInfo.Activate ( );
break;
case "salesInfo" :
... some code omitted for clarity ...
PageView salesInfo = ( PageView ) fvEmp.FindControl ( "salesInfo" );
salesInfo.Activate ( );
break;
}
}
And in case you have not noticed, most of the MultiPage examples in this workshop are used within a data control.
Nesting MultiPage Controls Using the MultiPage with the TabStrip WebControl