开发者

ASP.NET page with base class with dynamic master page not firing events

开发者 https://www.devze.com 2022-12-29 04:24 出处:网络
I am feeling that I have terribly wrong somewhere. I was working on a small asp.net app. I have some dynamic themes in the \\theme folder and have implemented a page base class to load the master page

I am feeling that I have terribly wrong somewhere. I was working on a small asp.net app. I have some dynamic themes in the \theme folder and have implemented a page base class to load the master page on the fly. The master is having the ContentPlaceHolder like:

<asp:ContentPlaceHolder ID="cphBody" runat="server" />

Now I am adding pages that are derived from my base class and added the form elements. I know, Visual Studio has problem showing the page in the design mode. I have a dropdown box and wish to add the event of onselectedindexchange. But it is not working. 开发者_Go百科the page is like this:

<%@ 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>

I have also tried adding the event on the code behind like:

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
}

Can anybody help?

Regards,


set AutoPostBack="true" on your dropdown

0

精彩评论

暂无评论...
验证码 换一张
取 消