问题:

SelectedIndexchanged不会触发。我试图调查一个断点,但它甚至没有涉及到该事件。
我通过双击组合框来创建事件。但这没有帮助。
请指教。

这是代码:

    protected void nav_dd_parent_edit_SelectedIndexChanged(object sender, EventArgs e)
            {

            }
    <td width="55%" class="style1" height="20px">
                                    <asp:DropDownList ID="nav_dd_parent_edit" runat="server"
                                        DataSourceID="sp_GetNavParents_Edit" DataTextField="Name"
                                        DataValueField="NavItemId" Height="24px" ReadOnly="FALSE" Width="375px"
                                        onselectedindexchanged="nav_dd_parent_edit_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </td>

protected void Page_Load(object sender, EventArgs e)
        {

            if (!Page.IsPostBack)
            {
                //Page.MaintainScrollPositionOnPostBack = true;
                //SiteMaster.g_solution = "Couche-Tard - QV";
                //SiteMaster.g_solution_id = 27;
                nav_dd_parent.DataBind();
                if (SiteMaster.g_solution != null && SiteMaster.g_solution != "")
                {
                    nav_literal.Text = "Solution: " + SiteMaster.g_solution;
                    nav_hidden_SoltnId.Value = SiteMaster.g_solution_id.ToString();
                }
                else
                {
                    nav_literal.Text = "Please select a solution first from the 'Solution Template' Tab.";
                    panel_top.Visible = false;
                }
            }

最佳答案

您看不到断点被击中,因为选择更改时下拉列表没有回发。

AutoPostBack设置为true,您应该已经准备就绪。

关于c# - SelectedIndexChanged,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8260664/

10-09 10:08