I'm working on a custom solution. One of the major UIs includes a calendar-style presentation. The navigation controls at the top of the calendar include four LinkButton controls (prevYear, prevMonth, nextMonth, nextYear) and two DropDownList controls (monthSelector, yearSelector). The DropDownList webcontrols are set with AutoPostBack=true. I have attached handlers to their SelectedIndexChanged events.
All of the LinkButtons work perfectly. The DropDownLists successfully AutoPostBack. But I can't get my SelectedIndexChanged handler to execute to save my life. Nagging me back in the recesses of my brain is the suspicion that I have solved this one before, but I still just cannot seem to get this to work.
Here's the Control Tree from the Trace, so you can see that these DDLs are buried pretty deep. The object "myCal" of type "Preaching.Web.UI.PreachingCalendar" is my custom control written entirely in C# and packaged up in a DLL.
Expand|Select|Wrap|Line Numbers
- __Page ASP.pcal_test_aspx
- ctl05 System.Web.UI.LiteralControl
- ctl00 System.Web.UI.HtmlControls.HtmlHead
- ctl02 System.Web.UI.HtmlControls.HtmlMeta
- ctl03 System.Web.UI.HtmlControls.HtmlMeta
- ctl04 System.Web.UI.HtmlControls.HtmlMeta
- pageTitle System.Web.UI.HtmlControls.HtmlTitle
- ctl06 System.Web.UI.LiteralControl
- ctl01 System.Web.UI.HtmlControls.HtmlForm
- ctl07 System.Web.UI.LiteralControl
- datasource Preaching.Web.UI.PreachingEventSqlPager
- ctl08 System.Web.UI.LiteralControl
- myCal Preaching.Web.UI.PreachingCalendar
- myCal$ctl00 System.Web.UI.WebControls.Table
- myCal$ctl56 System.Web.UI.WebControls.TableRow
- myCal$ctl57 System.Web.UI.WebControls.TableCell
- myCal$prevYear System.Web.UI.WebControls.LinkButton
- myCal$ctl58 System.Web.UI.LiteralControl
- myCal$prevMonth System.Web.UI.WebControls.LinkButton
- myCal$ctl59 System.Web.UI.WebControls.TableCell
- myCal$monthSelector System.Web.UI.WebControls.DropDownList
- myCal$yearSelector System.Web.UI.WebControls.DropDownList
- myCal$ctl60 System.Web.UI.WebControls.TableCell
- myCal$nextMonth System.Web.UI.WebControls.LinkButton
- myCal$ctl61 System.Web.UI.LiteralControl
- myCal$nextYear System.Web.UI.WebControls.LinkButton
- .....
Expand|Select|Wrap|Line Numbers
- // Set up DropDownList navigators for the title
- DropDownList monthSelector = new DropDownList();
- monthSelector.ID = "monthSelector";
- for (int i=0; i<12; i++) {
- monthSelector.Items.Add(new ListItem(DateTimeFormatInfo.InvariantInfo.MonthNames[i],
- (i+1).ToString()));
- }
- monthSelector.AutoPostBack = true;
- monthSelector.EnableViewState = false;
- monthSelector.SelectedIndex = VisibleDate.Month-1;
- monthSelector.DataBind();
- DropDownList yearSelector = new DropDownList();
- yearSelector.ID = "yearSelector";
- for (int i=VisibleDate.Year-10; i<=VisibleDate.Year+10; i++) {
- yearSelector.Items.Add(new ListItem(i.ToString(), i.ToString()));
- }
- yearSelector.AutoPostBack = true;
- yearSelector.EnableViewState = false;
- yearSelector.SelectedIndex = 10;
- yearSelector.DataBind();
- // Set up postback listeners for each control.
- prevYear.Click += new EventHandler(OnPrevYearClick);
- prevMonth.Click += new EventHandler(OnPrevMonthClick);
- nextMonth.Click += new EventHandler(OnNextMonthClick);
- nextYear.Click += new EventHandler(OnNextYearClick);
- monthSelector.SelectedIndexChanged += new EventHandler(OnMonthSelectorChanged);
- yearSelector.SelectedIndexChanged += new EventHandler(OnYearSelectorChanged);
Can anyone rescue me from my dufus-ness?