I'm running the ASPNET Ajax Q1 2008 trial with VS2005 / .NET 2.0 over WinXP SP2. I've been following the old tutorial, trying to do the sample where there is a dropdown for Today, LastWeek, etc, and two DatePickers. That works fine except when I try to use those controls and the Add button in a User control.
I think the basic question is how to ensure controls in a usercontrol are updated from a parent form. I am using the technique to pass the instance of the manager to the user control, and the control then registers its own components. Here is the code from the page containing the control:
And here is the code from the control:
The StartDate and EndDate properties in the user control are simple:
The issue is that the ddlDateRange does not fire SelectedDateChanged events on the datepickers. Those events are only fired when the user clicks the pbAdd button. The SelectedDate properties don't change, so the values returned through the public properties are essentially the original start/end dates from the controls.
I've read here that a panel needs to be put around the <uc1-/uc1> tags. I've done that, tried setting the panel in the AddAjaxSetting, tried getting the controls to ajaxify themselves. I'm really confused for many reasons which I will post elsewhere. For now, can someone suggest the proper rules and technique (or just point me to a comprehensive doc) for communicating between a parent page child usercontrols? TIA
I think the basic question is how to ensure controls in a usercontrol are updated from a parent form. I am using the technique to pass the instance of the manager to the user control, and the control then registers its own components. Here is the code from the page containing the control:
protected void Page_Load( object sender , EventArgs e ) |
{ |
if ( !Page.IsPostBack ) |
{ |
DateRangePicker1.ConfigureAjax(RadAjaxManager1); |
} |
} |
protected void pbAdd_Click( object sender , EventArgs e ) |
{ |
AccessDataSource1.FilterExpression = String.Format( |
"TransactionDate>='{0}' AND TransactionDate<='{1}'" , |
DateRangePicker1.StartDate , DateRangePicker1.EndDate); |
} |
And here is the code from the control:
public void ConfigureAjax( RadAjaxManager ajm ) { |
ajm.AjaxSettings.AddAjaxSetting( |
ddlDateRange , dpStart , RadAjaxLoadingPanel1); |
ajm.AjaxSettings.AddAjaxSetting( |
ddlDateRange , dpEnd , RadAjaxLoadingPanel1); |
} |
The StartDate and EndDate properties in the user control are simple:
return dpStart.SelectedDate; |
The issue is that the ddlDateRange does not fire SelectedDateChanged events on the datepickers. Those events are only fired when the user clicks the pbAdd button. The SelectedDate properties don't change, so the values returned through the public properties are essentially the original start/end dates from the controls.
I've read here that a panel needs to be put around the <uc1-/uc1> tags. I've done that, tried setting the panel in the AddAjaxSetting, tried getting the controls to ajaxify themselves. I'm really confused for many reasons which I will post elsewhere. For now, can someone suggest the proper rules and technique (or just point me to a comprehensive doc) for communicating between a parent page child usercontrols? TIA