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

Need general advice on the "scope" of the controls I add to ajax settings.

4 Answers 44 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Brent
Top achievements
Rank 1
Brent asked on 21 Oct 2008, 01:34 PM
Basically, I have pages with controls on them like this (I've left the properties out, for brevity):

<asp:Panel id="DataFormPanel">
    <asp:Panel id="NamePanel">
        <...controls here that I want to ajaxify...>
    </asp:Panel>
    <asp:Panel id="AddressPanel">
          <cc1:RadCombobox id="Country_DDL" />
          <asp:TextBox id="Addr1"/>
          <cc1:RadComboBox id="State_DLL" />
          <asp:TextBox id="PostalCode" />
          <cc1:RadComboBox id="County_DDL" />
    </asp:Panel>
</asp:Panel>
<asp:LinkButton id="save" />

- I'm using the AddAjaxSettings of the RadAjaxManager, to ajaxify controls.
- My goal in the above scenario would be to:
   1. Ajaxify the ENTIRE DataFormPanel so that it updates when the user clicks the Save linkbutton (it becomes invisible).
  2.  Ajaxify the Country_DDL so that it updates ONLY the State_DLL when the selected value of Country_DDL changes.
  3.  Ajaxify the State_DDL so that it updates ONLY the County_DLL when the selected value of State_DDL changes.

- The reason why I want to only ajaxify the single DDL's above, is so that when a user selects a country and tabs to Addr1 textbox, they can enter a value in the textbox without having it "wiped out or cleared" when the ajax request comes back from the server and populates the State_DLL.

- In other words, my scenario calls for ajaxifying controls that are located within an ajaxified panel.

PROBLEMS:
- When I try to just ajaxify the separate DDL controls (Country so that it only updates State, and State so that it only updates County), I get ajax error messages telling me that I need to surround the State_DDL with another UpdatePanel.
- When I ajaxify Country_DDL and have it update the entire AddressPanel, then the State_DLL also updates the entire AddressPanel even though I have ajaxified it to ONLY update the County_DDL.

I'm looking for general guidance on how to ajaxify many individual controls, when they are included in an ASP Panel that is also ajaxified.

Thanks in Advance,
Brent

4 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 22 Oct 2008, 12:33 PM
Hello Brent,

Could you please elaborate a little bit more on your project. If it is convenient for you, please open a regular support ticket and send us sample runnable application which represents the described behaviour. We will test it locally and provide accurate solution for your scenario.

Sincerely yours,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Colin Mulcahy
Top achievements
Rank 1
answered on 23 Oct 2008, 12:06 PM
Hello Brent,

I'm really curious about your challenge. I'm having a similar situation where I also ajaxify nested panels.

When you look at the page source when it loads do you get duplicate nested update panels?

I'm getting similar errors to you including loading panels not working as expected.

I've a funny feeling (unless otherwise informed) that these duplicate panels may be part of the problem.

Its almost like the ajax is picking the second panel(duplicate) and working with it. I've also noticed an increase in the time that the ajax takes.

Thanks Colin
0
Brent
Top achievements
Rank 1
answered on 23 Oct 2008, 12:22 PM

Maria, I've solved my problem and am getting the ajax behavior that I desire.  I definitely understand you asking me to open a support case, since these issues can be complicated, but that won't be necessary.  Thanks much though for your prompt response.  I find the forum support to be very helpful.

Colin, briefly I'll say that the javascript errors I was receiving were caused by me not ajaxifying all of the controls that I needed to ajaxify. 

Basically what we are doing as described in my original post, was that we have many different "levels" or "scopes" of ajax triggers and updated controls (with a panel simply being another control that happens to contain other controls of course). 

And the main goal was that while we wanted some trigger controls to update entire panels, we also wanted a control or two within those panels, to only trigger updates on a couple of other specific controls within those panels. 

For instance, when I change a combobox containing a list of Countries, I wanted to ONLY update another set of comboboxes and textboxes that related to States and Counties.  And when I change the combobox containing a list of States, I wanted to ONLY update the combobox with a list of Counties.  To accomplish this, I needed to ajaxify single controls.

And at the same time, I have a Save button that needs to do a partial postback of all of those controls back (and more), and then update that panel and another panel, so entire panels where ajaxified for that.

My javascript errors I was getting when I was attempting this, were occurring because I needed to ajaxify the Country combobox against itself (make it the trigger and the updated control).  Once I did that, my javascript errors were resolved and I got the behavior I was looking for.

I don't have alot of time to go into all of it, but I will paste my ajax settings into this post and based on the names of things, you should be able to deduce how I've ajaxified things.  And based on my description of what we wanted to accomplish, those settings should tell the rest of the story.  I hope this helps.

Incidentally, I do notice that the order of the ajax statements sometimes makes a difference on how things work... but I could be wrong on that.  But I try to ajaxify things from the inside out (smallest to largest scope).

I hope this helps.

AJAX SETTINGS:

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.Country_DDL, ucUCCIndexingFilingControlsParent.ucDebtors.Country_DDL,

null);

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.Country_DDL, ucUCCIndexingFilingControlsParent.ucDebtors.State_DDL,

null);

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.Country_DDL, ucUCCIndexingFilingControlsParent.ucDebtors.StateTextBox,

null);

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.Country_DDL, ucUCCIndexingFilingControlsParent.ucDebtors.County_DDL,

null);

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.Country_DDL, ucUCCIndexingFilingControlsParent.ucDebtors.CountyTextBox,

null);

 

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.State_DDL, ucUCCIndexingFilingControlsParent.ucDebtors.County_DDL,

null);

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.IndividualDebtorRadio, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorAddEditFormPanel,

null);

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.OrganizationDebtorRadio, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorAddEditFormPanel,

null);

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.OrganizationIDNoneCheckbox, ucUCCIndexingFilingControlsParent.ucDebtors.OrganizationIDTextBox,

null);

 

 

RadGrid DebtorsGrid = (RadGrid)ucUCCIndexingFilingControlsParent.ucDebtors.FindControl("DebtorGrid");

 

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(DebtorsGrid, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorAddEditFormPanel);

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(DebtorsGrid, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorsGridPanel);

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.CancelLinkButton, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorAddEditFormPanel);

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.CancelLinkButton, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorsGridPanel);

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.SaveLinkButton, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorAddEditFormPanel);

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.SaveLinkButton, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorsGridPanel);

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.SaveAndAddNewLinkButton, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorAddEditFormPanel);

UCCIndexingRadAjaxManager.AjaxSettings.AddAjaxSetting(ucUCCIndexingFilingControlsParent.ucDebtors.SaveAndAddNewLinkButton, ucUCCIndexingFilingControlsParent.ucDebtors.DebtorsGridPanel);

0
Maria Ilieva
Telerik team
answered on 23 Oct 2008, 12:34 PM
Hi Brent,

I'm glad to hear that you have managed to fix the problem.

If any additional requests arise in the future, do not hesitate to contact us back.

Thank you.

Greetings,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Brent
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Colin Mulcahy
Top achievements
Rank 1
Brent
Top achievements
Rank 1
Share this question
or