首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

上拉框数据绑定有关问题

2012-09-24 
下拉框数据绑定问题jq代码是点击开发人员就添加table,现在的问题是页面是服务端控件,动态加载的是html控件

下拉框数据绑定问题
jq代码是点击开发人员就添加table,现在的问题是页面是服务端控件,动态加载的是html控件,这两个数据还要一样,请问各位怎么下拉框怎么绑定数据和怎么取数据

Jq代码[code=JScript][/code]<script type="text/javascript">
  $(document).ready(function () {
  $("#but").click(function () {
  var len = $(".hidediv").find("table").get().length;
  var htm = "<table border=\"0\" id=" + (len + 1) + " style=\"background-color: Gray\" style=\"width: 100%\"><tr><td align=\"right\" width=\"15%\">技术负责人:</td><td width=\"15%\"><select id=\"ddlMandateHolders1\" style=\"width: 120px\"><option>请选择</option></select></td><td align=\"right\" width=\"15%\">开发人员:</td><td width=\"15%\"><select id=\"ddlDeveloper1\" style=\"width: 120px\"><option>请选择</option></select></td><td align=\"right\" width=\"8%\">职能:</td><td width=\"25%\"><input type=\"text\" style=\"width: 300px\" id=\"txtTaskContent1\" value=\"\" /></td></tr><tr><td align=\"right\" width=\"15%\">预计开始日期:</td><td width=\"15%\"><input type=\"text\" style=\"width: 120px\" id=\"txtExpectedDtartDate1\" value=\"\" class=\"Wdate\" onFocus=\"WdatePicker()\"></td><td align=\"right\" width=\"15%\">结束日期:</td><td><input type=\"text\" id=\"txtExpectedEndDate1\" style=\"width: 120px\" value=\"\" onFocus=\"WdatePicker()\" /></td><td><a href=\"javascript:void(0);\" onclick=\"deltr('" + (len + 1) + "')\"> 删除 </a></td></tr></table>";
  $("#TbData").show();
  $(".hidediv").append($(htm));
  });
  });
  function deltr(index) {
  $("table[id=\'" + index + "\']").remove();
  }

  </script>[code=HTML][/code] <table border="0" cellpadding="2" cellspacing="1" style="background-color: Gray"
  style="width: 100%">
  <tr>
  <td align="right" width="15%">
  技术负责人:
  </td>
  <td width="15%">
  <asp:DropDownList ID="ddlMandateHolders" runat="server" Width="120">
  </asp:DropDownList>
  </td>
  <td align="right" width="15%">
  开发人员:
  </td>
  <td width="15%">
  <asp:DropDownList ID="ddlDeveloper" runat="server" Width="120">
  </asp:DropDownList>
  </td>
  <td align="right" width="8%">
  职能:
  </td>
  <td width="25%">
  <asp:TextBox ID="txtTaskContent" runat="server" Width="300"></asp:TextBox>


  </td>
  <td width="15%">
  <input id="Checkbox1" onclick="yanqi(this)" type="checkbox" />延期
  </td>
  </tr>
  <tr>
  <td align="right" width="15%">
  预计开始日期:
  </td>
  <td width="15%">
  <asp:TextBox ID="txtExpectedDtartDate" runat="server" CssClass="Wdate" Width="120"
  onFocus="WdatePicker()"></asp:TextBox>
  </td>
  <td align="right" width="15%">
  结束日期:
  </td>
  <td>
  <asp:TextBox ID="txtExpectedEndDate" runat="server" CssClass="Wdate" Width="120"
  onFocus="WdatePicker()"></asp:TextBox>
  </td>
  </tr>
  </table>
  <input type="button" value="添加开发人员" id="but" />

[解决办法]
利用JS+AJAX读取数据后,在拼接htm 

或者加htm到页面后,在利用JS+AJAX初始化下拉框(根据下拉框ID)
[解决办法]
"<table border=\"0\" 

好给力啊,你为什么不这么写呢
‘<table border="0" 看着还清爽一点。。

热点排行