WebPart使用問題

來源:互聯網
上載者:User
在微軟的WebCast下載了有關WebPart的Demo
看了視頻後自己做了一下,當使用DropDownList改變WebPartManage的DisplayMode時,
會出錯如下錯誤:
 

“/DemoWebPart”應用程式中的伺服器錯誤。

此頁當前禁用指定的顯示模式。請確保為目前使用者啟用了個人化。
參數名: value

說明: 執行當前 Web 請求期間,出現未處理的異常。請檢查堆疊追蹤資訊,以瞭解有關該錯誤以及代碼中導致錯誤的出處的詳細資料。

異常詳細資料: System.ArgumentException: 此頁當前禁用指定的顯示模式。請確保為目前使用者啟用了個人化。
參數名: value

源錯誤:

行 26:                 break;            行 27:             case "d":            行 28:                 WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;            行 29:                 break;            行 30:             case "b":

源檔案: e:\DemoWebPart\Default.aspx.cs    行: 28

把下載來的Demo用Vs2005開啟,修改了web.config的資料庫連接後運行,也是報一樣的錯,在google搜了,
有一個人也遇到過這樣的問題,不過發出後沒有人能解決的了,想發到園子裡看看,有沒有朋友遇到並解決過.

運行時報錯的代碼如下(紅色部分):

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        switch (DropDownList1.SelectedValue)
        {
            case "c":
                WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
                break;
            case "e":
                WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;
                break;
            case "d":
                WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;
                break;
            case "b":
                WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
                break;
            default:
                WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
                break;
        }
    }
附:在WebCast下載的Demo http://files.cnblogs.com/szflying/DemoWebPart.rar

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.