Literal content is not allowed within a UserControl

前端 未结 4 1548
有刺的猬
有刺的猬 2021-01-18 02:38

How to allow my control contains a text inside it\'s tags?

Text

My control contains a complex t

4条回答
  •  忘掉有多难
    2021-01-18 03:17

    Assuming the UC generates a table, the easiest method I can think of is this:

    In the UserControl's ascx do something like this:

    
         ....
         
         .... 
      

    In the UserControl's code behind:

    public string CellContent 
    { 
      get { return ltCellContent.Text; } 
      set { ltCellContent.Text = value; } }
    }
    

    And to use it:

    
    

提交回复
热议问题