页面代码如下。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MYDDC.aspx.cs" Inherits="MYDDC.MYDDC" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>满意度调查</title>    <script type="text/javascript">
    
      function pageLoad() {
      }
    
    </script>    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <table class="style1">
                    <tr>
                        <td colspan="2" style="text-align: center">
                            <asp:Label ID="lbl_BT" runat="server" Text="标题"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="text-align: center">
                            <asp:Label ID="lbl_NR" runat="server" Text="内容"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="text-align: center">
                            <asp:Table ID="tab_MYDDC" runat="server">
                            </asp:Table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
就是只有一个Table控件。后台代码
/// <summary>
        /// 设置满意度调查内容
        /// </summary>
        /// <returns></returns>
        public void set_MYDDC(Table table)
        {
            TableRow tr = new TableRow();
            TableCell tc = new TableCell();
            table.HorizontalAlign = HorizontalAlign.Center;
            tc.Text = "<asp:Label ID=\"lbl_YWB\" runat=\"server\" Text=\"您对医务部总体评价如何?\"></asp:Label><br />"
            + "<asp:RadioButtonList ID=\"rbl_YWB\" runat=\"server\" AutoPostBack=\"True\" OnSelectedIndexChanged=\"rbl_YWB_SelectedIndexChanged\">"
                             + "<asp:ListItem>满意</asp:ListItem>"
                              + "<asp:ListItem>基本满意</asp:ListItem>"
                              + "<asp:ListItem>一般</asp:ListItem>"
                                + "<asp:ListItem>不满意</asp:ListItem>"
                                + "<asp:ListItem>不了解</asp:ListItem>"
                            + "</asp:RadioButtonList>"
                            + "<asp:Panel ID=\"Panel1\" runat=\"server\" Visible=\"false\">"
                                + "<asp:CheckBoxList ID=\"CheckBoxList1\" runat=\"server\" Height=\"25px\" Width=\"1089px\">"
                                    + "<asp:ListItem>服务态度不好</asp:ListItem>"
                                    + "<asp:ListItem>缺少与临床沟通</asp:ListItem>"
                                    + "<asp:ListItem>帮助临床协调解决问题能力有待提高</asp:ListItem>"
                                + "</asp:CheckBoxList>"
                                + "<asp:Label ID=\"Label1\" runat=\"server\" Text=\"其它意见和建议\"></asp:Label><br />"
                                + "<asp:TextBox ID=\"TextBox1\" runat=\"server\" Height=\"80px\" Width=\"1086px\"></asp:TextBox>"
                            + "</asp:Panel>";
            tr.Cells.Add(tc);
            table.Rows.Add(tr);
        }
但是这样根本不行。不知道是不是因为是asp:...控件的原因?
总之是希望实现网站内容用代码来实现。并不一定需要Table来控制。其它的也行
这个是个满意度调查系统。目的就是希望,所有内容能够自定义的去控制,方便后台维护
希望各路侠客赐教,求解脱

解决方案 »

  1.   

    你把这些内容
    <asp:Label ID=\"lbl_YWB\" runat=\"server\" Text=\"您对医务部总体评价如何?\"></asp:Label><br />"
      + "<asp:RadioButtonList ID=\"rbl_YWB\" runat=\"server\" AutoPostBack=\"True\" OnSelectedIndexChanged=\"rbl_YWB_SelectedIndexChanged\">"
      + "<asp:ListItem>满意</asp:ListItem>"
      + "<asp:ListItem>基本满意</asp:ListItem>"
      + "<asp:ListItem>一般</asp:ListItem>"
      + "<asp:ListItem>不满意</asp:ListItem>"
      + "<asp:ListItem>不了解</asp:ListItem>"
      + "</asp:RadioButtonList>"
      + "<asp:Panel ID=\"Panel1\" runat=\"server\"放在一个string str="这里面";前台用<%=str%>
    如果包含CSS和JS
    CSS和JS也不能丢这样肯定不能方便维护 维护的话 写XML里吧
      

  2.   

    LZ可以去做JAVA了...你已经领会到JAVA得真谛了! 阿门...
      

  3.   

    服务器控件不能用字符串的方式去动态添加
    TextBox tb = new TextBox();
    tb.Text="动态添加的TextBox";
    //tb.其他属性
    this.Controls.Add(tb);
      

  4.   

    看到楼上的提示,好像有点思路了。
    做个table,里面直接add控件?好像可行。我去试试。先谢谢大家了。