dropdownlist在前台用了这个方法,在后台改变selectIndex不触发前台事件,怎么办?
onChange="Show(this.value)" <asp:DropDownList ID="ddlType" onChange="Show(this.value)" runat="server" CssClass="txt"
AutoPostBack="false">
<asp:ListItem Value="1">大专</asp:ListItem>
<asp:ListItem Value="2">本科</asp:ListItem>
<asp:ListItem Value="3">博士</asp:ListItem>
</asp:DropDownList>
function Show(value) {
alert(value);
if (value == "1") {
document.getElementById("1").style.display = "block";
document.getElementById("2").style.display = "none";
document.getElementById("3").style.display = "none";
}
if (value == "2") {
document.getElementById("1").style.display = "none";
document.getElementById("2").style.display = "block";
document.getElementById("3").style.display = "none";
}
if (value == "3") {
document.getElementById("1").style.display = "none";
document.getElementById("2").style.display = "none";
document.getElementById("3").style.display = "block";
}
}
后台
if(!ispostback) ddlType.SelectedIndex =Object.value; 分不多了,麻烦大家帮我看看,谢谢
AutoPostBack="false">
<asp:ListItem Value="1">大专</asp:ListItem>
<asp:ListItem Value="2">本科</asp:ListItem>
<asp:ListItem Value="3">博士</asp:ListItem>
</asp:DropDownList>
function Show(value) {
alert(value);
if (value == "1") {
document.getElementById("1").style.display = "block";
document.getElementById("2").style.display = "none";
document.getElementById("3").style.display = "none";
}
if (value == "2") {
document.getElementById("1").style.display = "none";
document.getElementById("2").style.display = "block";
document.getElementById("3").style.display = "none";
}
if (value == "3") {
document.getElementById("1").style.display = "none";
document.getElementById("2").style.display = "none";
document.getElementById("3").style.display = "block";
}
}
后台
if(!ispostback) ddlType.SelectedIndex =Object.value; 分不多了,麻烦大家帮我看看,谢谢
...全文
相关推荐
DropDownList获取的SelectIndex一直为0的问题
1.想要DropDownList自动提交必须设置AutoPostBack=”true”属性,下面是代码: 代码如下: <asp ID=”ddlNameList” runat=”Server” Height=”30″ AutoPostBack=”True” xss=removed></asp> 2.在服务端处理的时候,尤其是初始化DropDownList的时候,没注意结果写错了,下面是错误代码: 代码如下: protected void Page
ASP常见问题与解决方法
ASP常见问题与解决方法,和大家分享下!
Asp.net常用代码
Asp.net常用代码仅供菜鸟试用!!Asp.net常用代码仅供菜鸟试用!!
dotnet常用代码
~~~~~~~~~~~~~~~~~~~~~~~~~~~
ASP.NET程序中常用的三十三种代码
ASP.NET程序中常用的三十三种代码


