マルチビュー コントロールを含む .net ページがあります。最初の「ビュー」には、ユーザーが入力する必要があるフォーム (データはデータベースに保存されます) があり、2 番目の「ビュー」には「ありがとう」のメッセージと作成したばかりの ID が表示されます。それは正常に動作します。問題は、2 番目の「ビュー」に「このページを印刷する」リンクを追加して、ユーザーが自分の ID を印刷できるようにしたことです (電子メールも受け取ります)。しかし、2 番目の「ビュー」でリンクボタンを押すと、最初のビューに戻ります。何が起こるのですか?
これは私のコードです:
<asp:MultiView id="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View id="View1" runat="server">
fields here
</asp:View>
<asp:View id="View2" runat="server">
<asp:Label ID="Label1" runat="server"></asp:Label>
<p>
<img alt="print" style="vertical-align:middle" src="images/printing.gif" /> <asp:LinkButton ID="LinkButton1" OnClientClick="window.print();" runat="server">
Remember to print this page</asp:LinkButton></p>
</asp:View>
</asp:MultiView>
分離コード:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
InsertNew()
End Sub
Sub InsertNew()
'all code here for inserting in database then
MultiView1.SetActiveView(View2)
Label1.Text = Text here with message
End Sub