一个ICallbackEventHandler 的奇怪问题

zlb789 2008-12-30 12:06:04

<script>
function getCity() {
   var provID = document.getElementById('<%=ddlPro.ClientID%>').value;
var context = '';
<% =CallBackCity() %>
}
function GetCitybyServer( context,timeMessage) {
alert(context);
var arrList=context.split(",");
if(document.getElementById('<%=ddlCity.ClientID%>')!=null)
{
var city=document.getElementById('<%=ddlCity.ClientID%>');
city.options.length=0;
for(j=0;j<arrList.length/2;j++)
{
city.options.add(new Option(arrList[2*j],arrList[2*j+1]));

}
}
}
function OnError(message, context) {
alert('数据连接错误:\n' + message);
}

</script>
<asp:DropDownList ID="ddlType" runat="server">
<asp:ListItem>照片名称</asp:ListItem>
<asp:ListItem>会员名称</asp:ListItem>
</asp:DropDownList> 按类型:<asp:DropDownList ID="ddlModlType" runat="server">
<asp:ListItem Value="-1">请选择</asp:ListItem>
</asp:DropDownList> 按地区:<asp:DropDownList ID="ddlPro" runat="server" onchange="getCity();">
<asp:ListItem>选择地区</asp:ListItem>
</asp:DropDownList><asp:DropDownList ID="ddlCity" runat="server">
</asp:DropDownList>

上面的方法竟然出错了 不能连动
但是 如果去掉 <asp:ListItem>照片名称</asp:ListItem>
<asp:ListItem>会员名称</asp:ListItem>
</asp:DropDownList> 按类型:<asp:DropDownList ID="ddlModlType" runat="server">
<asp:ListItem Value="-1">请选择</asp:ListItem>
</asp:DropDownList> 这个就OK 了

这是怎么回事 这跟DropDownList 有什么关系啊???
...全文
89 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lsn517471114 2008-12-30
  • 打赏
  • 举报
回复
.NET联盟会馆 QQ群号:77329563 招聘中.....
zlb789 2008-12-30
  • 打赏
  • 举报
回复
这个难道跟dropdown 这个控件有关系吗?
zhxhdean 2008-12-30
  • 打赏
  • 举报
回复
不懂,帮顶
zlb789 2008-12-30
  • 打赏
  • 举报
回复


问题搞找到了 , 原来是<asp:ListItem>照片名称 </asp:ListItem>
<asp:ListItem>会员名称 </asp:ListItem>
</asp:DropDownList> 这个没有value 的问题
我加了value 就没问题了

但这是why ??
  • 打赏
  • 举报
回复
city.options.length=0;


这是啥意思呢?清除options?
zlb789 2008-12-30
  • 打赏
  • 举报
回复
怎么回事 高手帮忙看下

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧