I believe that the MultiView control doesn't support this feature by default. What you can do is to implement own MultiView control inherited from the existing one and add to it desired functionality:
[DefaultProperty("Text")]
[ToolboxData("<{0}:MyMultiView runat=server></{0}:MyMultiView>")]
public class MyMultiView : MultiView
{
[Category("Behavoir")]
[DefaultValue(false)]
public bool RenderAllAtOnce
{
get
{
return (bool)(ViewState["RenderAllAtOnce"]?? false);
}
set
{
ViewState["RenderAllAtOnce"] = value;
}
}
protected override void Render(HtmlTextWriter writer)
{
if (!RenderAllAtOnce)
{
base.Render(writer);
}
else
{
foreach (View view in this.Views)
{
this.SetActiveView(view);
view.RenderControl(writer);
}
}
}
}
Then you can use that control instead of the default one and set RenderAllAtOnce property to true on some Print button click.
Also you can don't involving in new control creation and just render all views to string and pass it to some literal on a page:
.print
{
display: none;
}
@media print
{
.noPrint
{
display: none;
}
.print
{
display: block !important;
}
}
<div class="noPrint">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:View ID="View1" runat="server">
AAAA
</asp:View>
<asp:View ID="View2" runat="server">
BBBB
</asp:View>
<asp:View ID="View3" runat="server">
CCCC
</asp:View>
</asp:MultiView>
<asp:Button ID="btnPrint" runat="server" Text="Print" OnClick="btnPrint_Click" />
</div>
<div class="print">
<asp:Literal runat="server" ID="Literal1" Mode="PassThrough" />
</div>
protected void btnPrint_Click(object sender, EventArgs e)
{
var sb = new StringBuilder();
using (var writer = new StringWriter(sb))
using (var htmlWriter = new HtmlTextWriter(writer))
{
foreach (View view in MultiView1.Views)
{
view.RenderControl(htmlWriter);
}
}
Literal1.Text = sb.ToString();
ClientScript.RegisterStartupScript(this.GetType(), "print", "window.print();", true);
}