下拉列表中选择指数改不更新工作小组 [英] Drop Down List Selected Index changed not working in Update panel

查看:132
本文介绍了下拉列表中选择指数改不更新工作小组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UpdatePanel_2一个下拉列表,单击在UpdatePanel_1时Button_1它得到填充。

I have a drop down list in UpdatePanel_2, it gets populated when Button_1 is clicked in UpdatePanel_1.

我ddlist标记是,

My ddlist markup is,

<asp:DropDownList id="drop1" runat="server"  EnableViewState="true" AutoPostBack="true" OnSelectedIndexChanged="Drop1_SelectedIndexChanged" />



然后代码背后,是,

then code behind is,

 protected void Drop1_SelectedIndexChanged(object sender, EventArgs e)
        { }

我也试过把的AutoPostBack = true来我的DropDownList,仍然没有成功。

我还添加了triggre更新面板2,但没有增益,

I also added triggre to update panel 2 but no gain,

       <Triggers>
    <asp:AsyncPostbackTrigger ControlID="drop1" EventName="SelectedIndexChanged" />
</Triggers>



我使用一个按钮没有页面加载方式请回答前仔细阅读填充的DropDownList。
由于

推荐答案

嘿的数据来填充DDL在Page_Load事件,并经常检查的IsPostBack

Hey The data to populate the ddl in the page_load event and always check IspostBack

if(!IsPostBack)
{
 //DropDownList configuration
}

使用的EnableViewState

 <asp:DropDownList ID="ddlAddDepPlans" runat="server" AutoPostBack="true"    EnableViewState="true">
                </asp:DropDownList>



希望它可以帮助你。

Hope it helps you

这篇关于下拉列表中选择指数改不更新工作小组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆