<tr>
<td>
State:
</td>
<td>
<asp:DropDownList runat="server" ID="stateListBox" CssClass="ListBox" SelectionMode="Single"
DataTextField="stateorregion" DataValueField="stateorregion" AppendDataBoundItems="true"
OnSelectedIndexChanged="populateCourseListBox" AutoPostBack="true">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Course:
</td>
<td>
<asp:DropDownList runat="server" ID="courseListBox" CssClass="ListBox" SelectionMode="Single"
DataTextField="courseName" DataValueField="course_id" AppendDataBoundItems="true"
OnSelectedIndexChange="onCourseSelectedIndexChange" AutoPostBack="true">
</asp:DropDownList>
</td>
</tr>这两个DropDownList应该以相同的方式执行,调用populateCourseListBox而不调用onCourseSelectedIndexChange,没有编译器错误,没有运行时错误。我是不是漏掉了什么明显的东西?
这个想法是,当我选择一个州时,我想要填充该州的高尔夫球场,然后一旦我选择了一个高尔夫球场,我希望能够选择一个发球区。当我更改状态课程列表框被填充时,但是当我选择一个课程时,会调用page_load,但仅此而已。
发布于 2014-10-14 06:35:13
在您的课程DDL中,将OnSelectedIndexChange替换为OnSelectedIndexChanged。有个拼写错误。
如果控件属性不是事件标识符,它将被视为自定义属性。这就是为什么你没有得到任何错误的原因。:)
https://stackoverflow.com/questions/26349675
复制相似问题