本文介绍了开始在Visual Studio 2008中开发WebParts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

你好,
我已经开始开发WebParts,
我的第一个Webpart拥有以下代码:

Hello,
I have begun developing WebParts,
My first webpart has this code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI.WebControls.WebParts;

namespace Sample.DisplayMessage
{
    [
     WebBrowsable(true),
     WebDescription("Displays a custom message"),
     WebDisplayName("Display Message"),
     Personalizable(PersonalizationScope.User)
    ]
    public class DisplayMessageWebPart : WebPart
    {
        private string customMessage = "Hello, world!";

        public string DisplayMessage
        {
            get { return customMessage; }
            set { customMessage = value; }
        }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            writer.Write(DisplayMessage);
        }
    }

}



出现一些错误,我不知道如何纠正它们.

您能告诉我这段代码有什么问题以及如何获得正确版本的代码吗?

谢谢.

OP更新:
例如,属性WebBrowsable在这种声明中无效,它告诉我在索引器或属性的声明中有效.



Some errors appear and I don''t understand how to rectify them.

Can you tell me what is wrong with this code and how to get the right version of the code?

Thank you.

UPDATE from OP:
For example the attribute WebBrowsable is not valid in this kind of declaration it tells me that it is valid in the declaration of indexer or property.

推荐答案


这篇关于开始在Visual Studio 2008中开发WebParts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 14:27