读书人

不让DropDownList刷新页面但OnSelec

发布时间: 2012-04-18 15:01:59 作者: rapoo

不让DropDownList刷新页面,但OnSelectedIndexChanged事件需要触发,怎样实现
<asp:DropDownList ID="DDL_Type" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DDL_Type_SelectedIndexChanged">
</asp:DropDownList>


protected void DDL_Type_SelectedIndexChanged(object sender, EventArgs e)
{

if (Convert.ToInt32(this.DDL_Type.SelectedValue) > 0)
{
TProductType type = new TProductType("");
this.DDL_DetaiType.DataSource = type.GetList1(Convert.ToInt16(this.DDL_Type.SelectedValue));
this.DDL_DetaiType.DataValueField = "FID";
this.DDL_DetaiType.DataTextField = "FTypeName";
this.DDL_DetaiType.DataBind();
UpdatePanelNewPerAssetReg.Update();

}
}

不让dropdownlist刷新页面,但是OnSelectedIndexChanged还要触发,怎样实现,请大家帮帮忙


[解决办法]
使用UpdatePanel控件
[解决办法]
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp:UpdatePanel ID="" runat="">
<ContentTemplate>
<asp:DropDownList ID="DDL_Type" runat="server"AutoPostBack="true"OnSelectedIndexChanged="DDL_Type_SelectedIndexChanged">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>

读书人网 >C#

热点推荐