我觉得我某处非常错误。我正在开发一个小型的asp.net应用程序。我在\ theme文件夹中有一些动态主题,并实现了一个页面基类来动态加载母版页。主人正在使用ContentPlaceHolder:
<asp:ContentPlaceHolder ID="cphBody" runat="server" />
现在我要添加从我的基类派生的页面并添加表单元素。我知道,Visual Studio在设计模式下显示页面时出现问题。我有一个下拉框,希望添加onselectedindexchange的事件。但它没有用。页面是这样的:
<%@ Page Language="C#" AutoEventWireup="true" Inherits="trigon.web.Pages.MIS.JobStatus" Title="Job Status" AspCompat="true" CodeBehind="JobStatus.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphBody" runat="Server">
<div id="divError" runat="server" />
<asp:DropDownList runat="server" id="jobType" onselectedindexchange="On_jobTypeSelection_Change"></asp:DropDownList>
</asp:Content>
我也尝试在后面的代码上添加事件,如:
protected void Page_Load(object sender, EventArgs e)
{
jobType.SelectedIndexChanged += new System.EventHandler(this.On_jobTypeSelection_Change);
if (!IsPostBack)
{
JobStatus_DA da = new JobStatus_DA();
jobType.DataSource = da.getJobTypes();
jobType.DataBind();
}
}
protected void On_jobTypeSelection_Change(Object sender, EventArgs e)
{
//do something here
}
有人可以帮忙吗?
此致
答案 0 :(得分:0)
在您的下拉列表中设置AutoPostBack="true"