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

Related Comboboxes populate 2 RadGrids

5 Answers 99 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rick Hubka
Top achievements
Rank 1
Rick Hubka asked on 13 Jun 2009, 05:36 PM
I have requirements similar to the Related Comboboxes demo.  I took the code from this demo and replaced third RadComboBox with a RadGrid.  Just like the demo...  The User selects from the first RadComboBox1 which populates and opens the second RadComboBox2.  I need the selection from the second RadComboBox2 to populated 2 RadGrids with the RadComboBox2's "value".  Both RadGrids take the same 3 arguments.  The value from RadComboBox2 plus 2 other arguments so I'm binding the grid in code-behind.

I'm using your latest version of ASP.NET Ajax,  VS 2008 C# 3.5

I have searched the forums here and spent days trying dozens of solutions:
RadAjaxManagerProxy1_AjaxRequest
RadAjaxManager1_AjaxRequest, etc...

Now I'm getting weird looks from the boss.

Each time I attempt to get this to work, I get various problamatic results like:
The dropdowns work the first time but the second time clicking on the second dropdown does nothing.
The RadGrid populates but then both dropdowns are blank.
etc....

My needs are so much like the Related Comboboxes demo, I'm hoping someone will take the time to modify it to solve my problem.  I'm sure others will benifit from this modified example and it would be a nice added demo to the product.

Here's my latest version of my JS functions:
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
                <script type="text/javascript"
                    //global variables for the Process and cities comboboxes 
                    var ProcessCombo; 
                    function pageLoad() { 
                        // initialize the global variables 
                        // in this event all client objects 
                        // are already created and initialized 
                        ProcessCombo = $find("<%= RadComboBoxProcess.ClientID %>"); 
                    } 
                    function LoadProcess(combo, eventArqs) { 
                        var item = eventArqs.get_item(); 
                        ProcessCombo.set_text("Loading..."); 
 
                        // if a dept is selected 
                        if (item.get_index() > 0) { 
                            // this will fire the ItemsRequested event of the 
                            // Process combobox passing the DeptGuid as a parameter 
                            ProcessCombo.requestItems(item.get_value(), false); 
                        } 
                        else { 
                            // the -Select a continent- item was chosen 
                            ProcessCombo.set_text(" "); 
                            ProcessCombo.clearItems(); 
                        } 
                    } 
                    function LoadGrid(sender, eventArgs) { 
                        var item = eventArgs.get_item().get_value(); 
 
                        var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); 
                        ajaxManager.ajaxRequest(item); 
                    } 
                    function ItemsLoaded(combo, eventArqs) { 
                        if (combo.get_items().get_count() > 0) { 
                            // pre-select the first item 
                            combo.set_text(combo.get_items().getItem(0).get_text()); 
                            combo.get_items().getItem(0).highlight(); 
                        } 
                        combo.showDropDown(); 
                    } 
                </script> 
            </telerik:RadCodeBlock> 

Thanks...  Rick Hubka

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 18 Jun 2009, 07:19 AM
Hello Rick,

Please find attached a simple page baesd on your code demonstrating the needed approach. Download it and give it a try.

Best regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rick Hubka
Top achievements
Rank 1
answered on 18 Jun 2009, 10:37 PM
Thank you Yana

Your example code works well and It really cleaned up my code.  Thanks So Much!

However... when I put the code into my application It worked only once.  Then the second radcombobox box does not fire the RadAjaxManager1_AjaxRequest after the first time. I think, the problem is with my layered implementation.

My Radcomboboxes and RadGrid both sit on a User Control.  When the Web Site runs this User Control sites on a aspx page that also has a Master page.  I spent the whole day researching this and it appears I need to put my RadAjaxManager object onto my Master Page.  Then put a RadAjaxManagerProxy object onto my aspx page. 

That all sounds ok, but the problem then is that RadAjaxManagerProxy does not allow a method OnAjaxRequest like this
OnAjaxRequest="RadAjaxManager1_AjaxRequest"

So that's what I spent the whole day researching on the forums.

I'm stuck again.  But it does work once and I'm closer.

Can you or any of your colleges take the demo you sent me up a few level to match my senerio?
If you can I will never post for help again...  I promise!!
0
Yana
Telerik team
answered on 22 Jun 2009, 01:48 PM
Hi Rick,

This help article explains how to handle RadAjaxManager1_AjaxRequest event in the user control when using RadAjaxManagerProxy.

I've also attached your modified project to demonstrate you the described in the article approach.

Greetings,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rick Hubka
Top achievements
Rank 1
answered on 23 Jun 2009, 06:45 PM
Hi Yana

Thank you once again for giving me a simple working demo matching the exact application requirements I was having problems with.
I've been programming for 20 years and Telerik technical support can not be beat.

Regards

Rick Hubka
0
Yana
Telerik team
answered on 24 Jun 2009, 11:38 AM
Hello Rick,

I'm glad I could help.

All the best,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
Rick Hubka
Top achievements
Rank 1
Answers by
Yana
Telerik team
Rick Hubka
Top achievements
Rank 1
Share this question
or