在asp.net中创建带有填充下拉列表的动态div

时间:2015-10-21 13:30:19

标签: c# jquery html asp.net drop-down-menu

我需要创建一个动态创建页面内容的页面。 这就是所有文本框和下拉列表都是根据权限动态创建的,最后附加到div

public void BindPageData()
{
    try
    {
        string OutMsg = string.Empty;            
        OutMsg = GetPageCommentsHTML();

        if (!String.IsNullOrEmpty(OutMsg))
            div_dynamic.InnerHtml = OutMsg;
    }
    catch (Exception ex) {
      Log.Errlog("Error in BindPageData Method" + ex.Message); }
    }
}

字符串OutMsg的值

<table cellspacing="0" cellpadding='0' border="0px" width="50%">
    <tr>
        <td class="fieldtxt" align="right">
            NAME:
        </td>
        <td>
            <asp:DropDownList ID="ddr1" runat="server" CssClass="fieldtxtbox1" OnSelectedIndexChanged="ddlCommand_SelectedIndexChanged"></asp:DropDownList>                                           
        </td>
    </tr>
    <tr>
        <td class="fieldtxt" align="right" Visible="false">
            CLASS
        </td>
        <td>
            <asp:DropDownList ID="DropDownList1" runat="server" CssClass="fieldtxtbox1"  OnSelectedIndexChanged="ddlCommand2_SelectedIndexChanged"></asp:DropDownList>                                      
        </td>
    </tr>
    <tr>
        <td class="fieldtxt" align="right">
            SUBJECT
        </td>
        <td>
            <asp:DropDownList ID="DropDownList2" runat="server" CssClass="fieldtxtbox1" OnSelectedIndexChanged="ddlCommand3_SelectedIndexChanged"></asp:DropDownList>                                       
        </td>
    </tr>
</table>

现在我可以显示文本框和标签等所有字段。我的要求是在将数据绑定到动态div时需要填充下拉列表。 我怎么能这样做?

0 个答案:

没有答案