<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<td class="style27">
终点省
</td>
<td class="style17">
<asp:DropDownList ID="ddlEndProvince" runat="server" Width="150px" AutoPostBack="True"
OnSelectedIndexChanged="ddlEndProvince_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td class="style25">
终点市
</td>
<td class="td2">
<asp:DropDownList ID="ddlEndCity" runat="server" Width="150px" AutoPostBack="True"
OnSelectedIndexChanged="ddlEndCity_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td class="style20">
终点县
</td>
<td class="td2" colspan="3">
<asp:DropDownList ID="ddlEndCounty" runat="server" Width="150px">
</asp:DropDownList>
</td>
</ContentTemplate>
</asp:UpdatePanel>为什么用了updatepanel还闪一下呢,我想不要刷新,怎么处理?
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<td class="style27">
终点省
</td>
<td class="style17">
<asp:DropDownList ID="ddlEndProvince" runat="server" Width="150px" AutoPostBack="True"
OnSelectedIndexChanged="ddlEndProvince_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td class="style25">
终点市
</td>
<td class="td2">
<asp:DropDownList ID="ddlEndCity" runat="server" Width="150px" AutoPostBack="True"
OnSelectedIndexChanged="ddlEndCity_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td class="style20">
终点县
</td>
<td class="td2" colspan="3">
<asp:DropDownList ID="ddlEndCounty" runat="server" Width="150px">
</asp:DropDownList>
</td>
</ContentTemplate>
</asp:UpdatePanel>为什么用了updatepanel还闪一下呢,我想不要刷新,怎么处理?
我想要dropdownlist无刷新的三级级联
http://cindylu520.javaeye.com/blog/645262
公司行政区域表的数据是最完整的。
所以我想用dropdownlist来做``````````````
帮帮解决谢谢,
自己尝试用js写吧。
是因为页面回传了肯定要闪一下了!
实现联动的方式:
1、利用ajax技术、2、在后台利用代码操作实现联动
function o(v) {
return document.getElementById(v);
}
function getSmailSelect(value) {
var act = 'ac';
PostPage("id=" + escape(value), "/ajax/city.aspx");
var obj = GetValue();
var cboBigType = o(city");
cboBigType.options.length = 0;
obj = obj.substring(1);
var v = obj.split("|");
for (var i = 0; i < v.length; i++) {
c = v[i].split("@")
cboBigType.options.add(new Option(c[0], c[1]));
}
}
function getSelectValue(value) {
o("cityvalue").value = value;
} ajax/city.aspx.cs代码
protected void Page_Load(object sender, EventArgs e)
{
string id = Request.Form["id"].ToString();
StringBuilder strsql = new StringBuilder();
strsql.Append("select Cid,cityName Table where Pid='" + id + "'");
DataTable dt = SQLHelper.Query(strsql.ToString()).Tables[0];
string sel = "";
for (int i=0; i < dt.Rows.Count; i++)
{
sel = sel + "|" + dt.Rows[i]["cityName"].ToString() + "@" + dt.Rows[i]["Cid"].ToString();
}
Response.Write(sel);
}
///这里直接读取省份
<select name="shengfen" id="shengfen" onchange="getSmailSelect(this.value)">
<option value="-1">--请选择--</option>
</select>
<select name="city" id="city" onchange="getSelectValue(this.options[this.selectedIndex].text);">
<option value="-请选择区域-">-请选择区域-</option>
</select>
<input id="hidden" type="cityvalue" runat=server />