控件的設計時支持(ControlDesigner)

public class TestDesigner : ControlDesigner
    {
        
       
        public override string GetPersistInnerHtml()
        {
                  return text.ToString();
        }

        public override string GetDesignTimeHtml()
        {
            try
            {
                            return “();
             }
            catch (Exception e)
            {
                return GetErrorDesignTimeHtml(e);
            }
        }

        protected override string GetEmptyDesignTimeHtml()
        {
            //Render design time warning if there's nothing to display.
            string text = "Please add Services to the toolbar.";
            return CreatePlaceHolderDesignTimeHtml(text);
        }

        protected override string GetErrorDesignTimeHtml(Exception e)
        {
            string text = string.Format("{0}{1}{2}{3}",
                "There was an error and the control can't be displayed.",
                "<BR>", "Exception: ", e.Message);

            return CreatePlaceHolderDesignTimeHtml(text);
        }

    } 

 

 

[Designer(typeof(ScriptManagerDesigner))]

public class Test

{

 

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章