【发布时间】:2011-04-25 00:57:11
【问题描述】:
这是一个快速的代码 sn-p,这对我来说似乎根本不起作用。我正在从文件中读取以创建单选按钮列表。问题是,当单击其中一个单选按钮时,我在代码中设置的事件处理程序不会触发。我已经用换行符在调试模式下一遍又一遍地测试它......一切都没有运气。我在这里遗漏了一些明显的东西吗????
感谢高级!
strLine = strLine.Trim();
System.Diagnostics.Debug.WriteLine("[3-a] ship by date - date: " + strLine);
try{ shipByDate = (Convert.ToDateTime(strLine)); }
catch (Exception e) { shipByDate = new DateTime(); }
shipByDesc = sr.ReadLine().Trim();
System.Diagnostics.Debug.WriteLine("[3-b] ship by date - desc: " + shipByDesc);
RadioButton button = new RadioButton();
button.Text = shipByDesc + " - " + shipByDate.ToString("MM/dd/yyyy");
button.Checked = false;
button.GroupName = "shipByOptions";
button.ID = "shipByRadio" + count;
//button.EnableViewState = true;
button.AutoPostBack = true;
button.CheckedChanged += new EventHandler(shipBy_CheckedChanged); // <-- doesn't work!!!
//form1.Controls.Add(button);
shipByPlaceHolder.Controls.Add(button);
【问题讨论】:
标签: c# asp.net visual-studio