asp的SelectedIndexChanged:在li中没有触发DropDownList

时间:2014-01-23 08:36:39

标签: c# asp.net

我遇到了DropDownList控件的SelectedIndexChanged问题。贝娄是我的代码。

设置下拉列表

<div class="add-contact-contet-wrapper">
    <ul>
        <li><span style="display: inline-block;">
            <asp:DropDownList ID="ddActionType" runat="server" CssClass="action-textbox slct-wdth-162px" OnSelectedIndexChanged="ddActionType_SelectedIndexChanged" OnTextChanged="ddActionType_SelectedIndexChanged" AutoPostBack="True" EnableViewState="True">
        </li>
    </ul>
</div>

的Page_Load

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
         loadDropDownLists();
}

绑定下拉列表

private void loadDropDownLists()
{
    ActionTypeCtrl atCtrl = new ActionTypeCtrl();
    this.ddActionType.Items.Clear();
    this.ddActionType.Items.Add("-Action Type-");
    this.ddActionType.AppendDataBoundItems = true;
    this.ddActionType.DataSource = atCtrl.getActionTypeList();
    this.ddActionType.DataTextField = "ActionTypeName";
    this.ddActionType.DataValueField = "ID";
    this.ddActionType.DataBind();
}

dropdownlist selectedindexchange事件

protected void ddActionType_SelectedIndexChanged(object sender, EventArgs e)
{
    ActionTypeCtrl atCtrl = new ActionTypeCtrl();
    string url = atCtrl.GetActypeUrl(ddActionType.SelectedValue.ToString());
    Response.Redirect(url);
}

它会在每次点击时加载页面,但不会触发下拉列表事件。我在其他项目中有相同的情况,它工作正常。我不知道是什么问题。任何想法???

此致

拉​​加

0 个答案:

没有答案