首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

不让DropDownList刷新页面,但OnSelectedIndexChanged事件需要触发,怎样实现解决办法

2012-04-18 
不让DropDownList刷新页面,但OnSelectedIndexChanged事件需要触发,怎样实现asp:DropDownList IDDDL_Typ

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

热点排行