Label1.Text = "<asp:DropDownList ID=\"DropDownList1\" runat=\"server\"><asp:ListItem Value=\"0\">签到</asp:ListItem><asp:ListItem Value=\"1\">迟到</asp:ListItem><asp:ListItem Value=\"2\">旷课</asp:ListItem></asp:DropDownList>";
在后台中写的代码。
前台添加了一个label控件  但是显示不出droupdownlist。是label的text属性不能这样设置么?

解决方案 »

  1.   

    以前在label的text中写linkbutton没什么问题 ,这个是否有什么限制?
      

  2.   

    Label 和 DropDownList 有什么关系  
      

  3.   

    droupdownlist控件要
    DropDownList DropDownList1=new DropDownList();
    Controls.Add(droupdownlist1);才能实现添加
      

  4.   

    前台代码: <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
      

  5.   

    label里面的值 中包含dropdownlist控件
      

  6.   

    label里面的值 是由dropdownlist控件和一些样式构成的也就是在label的text属性中写样式和控件
      

  7.   

    label是自动做了处理的。就是说里面的html字符,不会转义。它不会帮你转成为html字符。
    最好是这样,在页面上<%=字符串A%>
    后台public string 字符串A;
    字符串A="你要写的";
      

  8.   

    这个应该在后置代码写比较容易理解  DropDownList.selectedItem.text=lable.text