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

Related ComboBoxes in Popup GridEditForm

3 Answers 76 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Philip Senechal
Top achievements
Rank 1
Philip Senechal asked on 04 Nov 2010, 01:25 AM
Greetings...

I'm attempting to implement the code from the Related ComboBoxes demo using a Country/State combination. My issue is that I'm doing so in a Popup GridEditForm Template. I'm running into problems with gaining access to the State combo. In the demo, you are using the PageLoad event and a $find("<%= RadComboBox2.ClientID %>"); statement to set a global variable to be used later. Obviously this isn't an option with the GridEditForm Template.

Is there a way to gain access to that second ComboBox in the GridEditFormTemplate so I can kick off the requestItems with the value of the first ComboBox?

Your assistance is much appreciated.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Nov 2010, 09:44 AM
Hello Philip,

The following code library will help you to achieve your requirement.
 Accessing server controls in a grid template on the client

Thanks,
Princy.
0
Philip Senechal
Top achievements
Rank 1
answered on 04 Nov 2010, 07:37 PM
See next post please...
0
Philip Senechal
Top achievements
Rank 1
answered on 04 Nov 2010, 08:13 PM
I actually found a much easier way to do it using the following code...
<div class="popup_title">
    Physical State:
</div>
<div class="popup_content">
    <telerik:RadComboBox ID="dd_unit_phys_st" Skin="Windows7" Font-Size="11px" ShowToggleImage="true"
        OnClientItemsRequested="ItemsLoaded" OnItemsRequested="dd_unit_phys_st_ItemsRequested"
        runat="server" />
</div>
<div class="clear">
</div>
<div class="popup_title">
    Physical Country:
</div>
<div class="popup_content">
    <telerik:RadComboBox ID="dd_unit_phys_co" Skin="Windows7" Font-Size="11px" ShowToggleImage="true"
        OnClientSelectedIndexChanged="LoadStates" runat="server" />
</div>
<div class="clear">
</div>
<telerik:RadScriptBlock ID="RadScriptBlock4" runat="server">
    <script type="text/javascript">
        function LoadStates(combo, eventArgs) {
            var statesCombo = $find('<%# Container.FindControl("dd_unit_phys_st").ClientID %>');
            var item = eventArgs.get_item();
            statesCombo.set_text("Loading...")
 
            if (item.get_index() > 0) {
                alert("TEST");
                statesCombo.requestItems(item.get_value(), false);
            }
            else {
                statesCombo.set_text(" ");
                statesCombo.clearItems();
            }
        }
 
        function ItemsLoaded(combo, eventArgs) {
            if (combo.get_items().get_count() > 0) {
                combo.set_text(combo.get_items().getItem(0).get_text());
                combo.get_items().getItem(0).highlight;
            }
            combo.showDropDown;
        }
    </script>
</telerik:RadScriptBlock>

and the same code behind as before to load the Countries dropdown in the Grid ItemDataBound event and the States dropdown in a ItemsRequested event.

I can see that I'm getting to my control because "Loading..." appears in the States dropdown, however, instead of bringing back the list of states, it's popping this error message:

The target ctl00$Content$C000$RadGrid1$ctl00$ctl05$dd_unit_phys_st for the callback could not be found or did not implement ICallbackEventHandler.

Any suggestions?
Tags
ComboBox
Asked by
Philip Senechal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Philip Senechal
Top achievements
Rank 1
Share this question
or