0

我有以下代码应该在模式弹出窗口中运行:

#region events


protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        dt = DataObj.GetDataTable("GetScheduleNames");
        foreach (DataRow myrow in dt.Rows)
        {
            SchedNameLst.Add(Convert.ToString(myrow["ScheduleName"]));
        }
        SchedNameListDD.DataSource = SchedNameLst;
        SchedNameListDD.DataBind();

    }
}

 protected void SchedNameListDD_SelectedIndexChanged(object sender, EventArgs e)
{
    // should be in selected index fired event
    SchedName.Text = SchedNameListDD.SelectedItem.Text;
    string name = SchedNameListDD.SelectedItem.Text;
    dt = DataObj.GetDataTable("GetSchedDetails", name);

    foreach (DataRow myrow in dt.Rows)
    {
        StartTime.Text = myrow["StartTime"].ToString();
        EndTime.Text = myrow["EndTime"].ToString();
    }
    dt = DataObj.GetDataTable("GetSchedDetailsSat", name);
    foreach (DataRow myrow in dt.Rows)
    {
        SatSt.Text = myrow["StartTime"].ToString();
        SatEt.Text = myrow["EndTime"].ToString();
    }
 }


#endregion

当我在下拉列表中更改我的项目选择时,我的 selectedIndexChanged 事件不会被触发.. y 是这样吗?

4

2 回答 2

0

使用 onchange="javascript: __doPostBack(' Dropdownlist ',' Patamers ')"

于 2014-09-25T06:35:56.383 回答
0
  1. 确保您已在控件上启用 AutoPostBack,即AutoPostBack = "true"
  2. 确保通过EnableViewState="true"在 Page 或 UserControl 指令中设置启用视图状态
于 2012-10-14T04:15:02.637 回答