日期:2014-05-18  浏览次数:20888 次

不让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>