1
我有一個帶有多視圖控件的.net頁面。在第一個「視圖」中,我有一個用戶需要填寫的表單(數據存儲在數據庫中),第二個「視圖」帶來了「謝謝」信息和剛剛創建的ID。它工作正常。問題是我在第二個「視圖」中添加了「打印此頁」鏈接,以便用戶可以打印他們的ID(他們還會重新發送電子郵件)。但是當他們在第二個「視圖」中按下鏈接按鈕時,它會回到第一個視圖。怎麼了?Multiview返回到第一個視圖
這是我的代碼:
<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
哎呀,應該知道的!非常感謝! – netNewbi3 2010-07-02 09:04:59