SelectedDateChanged无法使用Dynamic DatePicker?

时间:2014-08-22 07:39:40

标签: c# asp.net rad-controls raddatepicker

我有一个动态DatePicker,我想调用SelectedDateChanged事件,但它不工作/解雇?虽然我在样本应用程序上使用相同的代码,但它在那里工作正常,但在我的应用程序中它不工作?谁能告诉我可能的原因是什么? 这是我的代码

        else if (_db.DbProviderFactory.ToString().Contains("OracleClient"))
        {
            RadDatePicker mtb = new RadDatePicker();
            mtb.ID = "MTB" + _caption.Replace(" ", "_").ToUpper();
            string id="MTB" + _caption.Replace(" ", "_").ToUpper();;
            mtb.EnableViewState = false;
            mtb.Attributes.Add("runat", "Server");
            mtb.SelectedDate = DateTime.Now;

            // Both Event
            mtb.Attributes.Add("onchange", "oraProcessDate('" +        "ctl00_ContentPlaceHolder1_" + mtb.ID + "'," + n + "); return false;");
            mtb.Attributes.Add("onblur", "oraProcessDate('" + "ctl00_ContentPlaceHolder1_" + mtb.ID + "'," + n + "); return false;");
            mtb.AutoPostBack = true;
            //mtb.SelectedDateChanged += new Telerik.Web.UI.Calendar.SelectedDateChangedEventHandler(mtb_SelectedDateChanged);
            mtb.SelectedDateChanged += new Telerik.Web.UI.Calendar.SelectedDateChangedEventHandler(pckDate_SelectedDateChanged);
            //rdp.SelectedDateChanged += new SelectedDateChangedEventHandler(rdp_SelectedDateChanged); 
           // mtb.AutoPostBack = true;
            //this.mtb.+= new EventHandler<SelectionChangedEventArgs>(datePicker_SelectedDateChanged);
            //mtb.SelectedDateChanged += new SelectedDateChangedEventHandler(mtb_changed);
            //mtb.SelectedDateChanged+=
            mtb.Width = 200;
            tc.Controls.Add(mtb);
            tc.Style.Add("width", "35%");
            tr.Cells.Add(tc);
            ValidateFields(n, _requirefield.ToString());
            mtb.SelectedDateChanged += new Telerik.Web.UI.Calendar.SelectedDateChangedEventHandler(pckDate_SelectedDateChanged);
        }
    }


    protected void pckDate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
    {
        lblMessage.Text = "testttttttting";

    }

0 个答案:

没有答案