This is a migrated thread and some comments may be shown as answers.

RadAjaxManager and UserControls - again

2 Answers 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
TonyG
Top achievements
Rank 1
TonyG asked on 16 Jun 2008, 11:36 AM
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:
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

2 Answers, 1 is accepted

Sort by
0
TonyG
Top achievements
Rank 1
answered on 16 Jun 2008, 12:41 PM
Oh No! I didn't set the autopostback on the controls.

Never mind...

Thanks to Randel:
http://www.telerik.com/community/forums/thread/b311D-bdkhem.aspx
0
Missing User
answered on 18 Jun 2008, 01:13 PM
Hi TonyG,

We are glad that you have found a solution for the problem.

All the best,
Plamen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
TonyG
Top achievements
Rank 1
Answers by
TonyG
Top achievements
Rank 1
Missing User
Share this question
or