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

Find value of 2 radcomboboxes in script while populating data in 3rd radcombobox using webservice

6 Answers 105 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
prachi s
Top achievements
Rank 1
prachi s asked on 17 Mar 2010, 12:43 PM
Hello guys,
i m not much familier with rad controls, i have problem with radcombobox while i m populating data in 3rd radcombobox using selected value of first 2 radcomboboxes using web service. please help me to do this
thanks in advance.

6 Answers, 1 is accepted

Sort by
0
prachi s
Top achievements
Rank 1
answered on 18 Mar 2010, 06:17 AM
can anybdy help me?
0
Kalina
Telerik team
answered on 19 Mar 2010, 01:20 PM
Hi prachi s,

In order to help you we will need more information.

Could you please describe in more detail what your implementation is and paste your code here?

Thank you in advance.

Kalina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
prachi s
Top achievements
Rank 1
answered on 19 Mar 2010, 01:58 PM
Hi Kalina ,
Thanks for your response,
Actually i have 6 RadcomboBoxes, 3 in one group and other 3 are in another group.
for Country,State and City, I used SqlDataSource to populate Country in both group and populating state & citiy according to value of Country through Web service but when i m going to populate state and City according to country in 1st group it reffers to Country value in 2nd group, but while populating state, city in 2nd group it populates correct according to my country in 2 nd group.
what can i do for this?
0
prachi s
Top achievements
Rank 1
answered on 19 Mar 2010, 02:24 PM
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="New.ascx.vb" Inherits="New" %> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<head> 
 
    <style type="text/css">  
        .style1  
        {  
            width: 145px;  
        }  
        .style2  
        {  
            width: 154px;  
        }  
        .style3  
        {  
            width: 202px;  
        }  
    </style> 
 
</head> 
<body> 
<div> 
           <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="Update3">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="Update3" /> 
                            <telerik:AjaxUpdatedControl ControlID="DDlPState" /> 
                            <telerik:AjaxUpdatedControl ControlID="DDlPCity" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings>   
            </telerik:RadAjaxManager> 
            <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server" > 
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="Update1">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="Update1" /> 
                            <telerik:AjaxUpdatedControl ControlID="DDlState" /> 
                            <telerik:AjaxUpdatedControl ControlID="DDlCity" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
            </telerik:RadAjaxManager> 
        &nbsp;<br /> 
&nbsp;<table style="width:auto ">  
    <tr> 
        <td colspan="2"></td> 
        <td class="style2">  
        </td> 
        <td> 
        </td> 
    </tr> 
    <tr> 
        <td class="style3">  
            <asp:Label ID="Label3" runat="server" Text="Country" Width="180px" Font-Names="Verdana" Font-Size="Smaller" Height="16px"></asp:Label> 
            <asp:Label id="Label20" Text=":" runat="server" Font-Names="Verdana" Font-Size="Smaller"></asp:Label> 
        </td> 
        <td class="style1">  
            <asp:Panel ID="Update1" runat="server" > 
                <telerik:RadComboBox ID="DDlCountry" runat ="server" Skin="WebBlue" Height="200px"   
                width="175px" DataSourceID="SqlDataSource1"   
                    DataTextField="CountryName" DataValueField="CountryID" > 
                </telerik:RadComboBox>    
            </asp:Panel> 
            </td> 
        <td class="style2">  
            <asp:Label ID="Label5" runat="server" Text="Country" Width="137px" Font-Names="Verdana" Font-Size="Smaller" Height="16px"></asp:Label> 
            <asp:Label id="Label21" Text=":" runat="server" Font-Names="Verdana" Font-Size="Smaller"></asp:Label> 
        </td> 
        <td> 
            <asp:Panel ID="Update3" runat="server" > 
                <telerik:RadComboBox ID="DDlPCountry" runat ="server" Skin="WebBlue" Height="200px"   
                width="175px" DataSourceID="SqlDataSource2"   
                    DataTextField="CountryName" DataValueField="CountryID" > 
                </telerik:RadComboBox> 
            </asp:Panel> 
        </td> 
    </tr> 
    <tr> 
        <td class="style3">  
            <asp:Label ID="Label4" runat="server" Text="State" Width="179px" Font-Names="Verdana" Font-Size="Smaller" Height="16px"></asp:Label> 
            <asp:Label id="Label19" Text=":" runat="server" Font-Names="Verdana" Font-Size="Smaller"></asp:Label> 
        </td> 
        <td class="style1">  
        <telerik:RadComboBox ID="DDlState" runat="server" Width="175px" Height="200px" Skin="WebBlue" 
                OnClientItemsRequested="OnClientItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting" 
                EnableLoadOnDemand="true" OnClientDropDownClosed="OnClientDropDownClosed" EnableItemCaching="true">  
                <ExpandAnimation Type="none" /> 
                <CollapseAnimation Type="none" /> 
                <WebServiceSettings Path="WebService.asmx"  Method="GetCountry"  /> 
            </telerik:RadComboBox> 
            <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock5">  
                <script type="text/javascript">  
                    var startTime;  
                    var sendRequest = true;  
                    var calculate = false;  
                    function OnClientItemsRequesting(sender, args) {  
                        var inp1 = $find('<%= DDlCountry.ClientId %>');  
                        args.get_context()["Item"] = inp1.get_value();  
                        var context2 = $find('<%= DDlState.ClientId %>');  
                        args.get_context()["str"] = context2.get_value();  
                        startTime = new Date();  
                    }  
 
                    function OnClientItemsRequested(sender, args) {  
                    }  
 
                    function OnClientDropDownClosed(sender, args) {  
                        sender.clearItems();  
                        if (args.get_domEvent().stopPropagation)  
                            args.get_domEvent().stopPropagation();  
                    }  
                </script> 
 
            </telerik:RadScriptBlock> 
        </td> 
        <td class="style2">  
            <asp:Label ID="Label6" runat="server" Text="State" Width="136px" Font-Names="Verdana" Font-Size="Smaller"></asp:Label> 
            <asp:Label id="Label22" Text=":" runat="server" Font-Names="Verdana" Font-Size="Smaller"></asp:Label> 
        </td> 
        <td> 
         <telerik:RadComboBox ID="DDlPState" runat="server" Width="175px" Height="200px" Skin="WebBlue" 
                OnClientItemsRequested="OnClientItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting" 
                EnableLoadOnDemand="true" OnClientDropDownClosed="OnClientDropDownClosed" EnableItemCaching="true">  
                <ExpandAnimation Type="none" /> 
                <CollapseAnimation Type="none" /> 
                <WebServiceSettings Path="WebService.asmx"  Method="GetCountry"  /> 
            </telerik:RadComboBox> 
            <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock1">  
                <script type="text/javascript">  
                    var startTime;  
                    var sendRequest = true;  
                    var calculate = false;  
                    function OnClientItemsRequesting(sender, args) {  
                        var input = $find('<%= DDlPCountry.ClientId %>');  
                        args.get_context()["Item"] = input.get_value();  
                        var context1 = $find('<%= DDlPState.ClientId %>');  
                        args.get_context()["str"] = context1.get_value();  
                        startTime = new Date();  
                    }  
 
                    function OnClientItemsRequested(sender, args) {  
                    }  
 
                    function OnClientDropDownClosed(sender, args) {  
                        sender.clearItems();  
                        if (args.get_domEvent().stopPropagation)  
                            args.get_domEvent().stopPropagation();  
                    }  
                </script> 
 
            </telerik:RadScriptBlock> 
            </td> 
    </tr> 
        <tr> 
        <td class="style3">  
            <asp:Label ID="Label7" runat="server" Text="City" Width="178px" Font-Names="Verdana" Font-Size="Smaller" Height="16px"></asp:Label> 
            <asp:Label id="Label18" Text=":" runat="server" Font-Names="Verdana" Font-Size="Smaller"></asp:Label> 
        </td> 
        <td class="style1">  
            <telerik:RadComboBox ID="DDlCity" runat="server" Width="175px" Height="200px" Skin="WebBlue" 
                OnClientItemsRequested="OnClientItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting" 
                EnableLoadOnDemand="true" OnClientDropDownClosed="OnClientDropDownClosed"   
                EnableItemCaching="true">  
                <ExpandAnimation Type="none" /> 
                <CollapseAnimation Type="none" /> 
                <WebServiceSettings Path="WebService.asmx"  Method="GetCity" /> 
            </telerik:RadComboBox> 
            <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock3">  
                <script type="text/javascript">  
                    var startTime;  
                    var sendRequest = true;  
                    var calculate = false;  
                    function OnClientItemsRequesting(sender, args) {  
                        var input = $find('<%= DDlCountry.ClientId %>');  
                        args.get_context()["Item"] = input.get_value();  
                        var input1 = $find('<%= DDlState.ClientId %>');  
                        args.get_context()["Item1"] = input1.get_value();  
                        var context1 = $find('<%= DDlCity.ClientId %>');  
                        args.get_context()["str"] = context1.get_value();  
                        startTime = new Date();  
                    }  
 
                    function OnClientItemsRequested(sender, args) {  
                    }  
 
                    function OnClientDropDownClosed(sender, args) {  
                        sender.clearItems();  
                        if (args.get_domEvent().stopPropagation)  
                            args.get_domEvent().stopPropagation();  
                    }  
                </script> 
 
            </telerik:RadScriptBlock> 
            </td> 
        <td class="style2">  
            <asp:Label ID="Label8" runat="server" Text="City" Width="138px" Font-Names="Verdana" Font-Size="Smaller" Height="16px"></asp:Label> 
            <asp:Label id="Label23" Text=":" runat="server" Font-Names="Verdana" Font-Size="Smaller"></asp:Label> 
        </td> 
        <td> 
                <telerik:RadComboBox ID="DDlPCity" runat="server" Width="175px" Height="200px" Skin="WebBlue" 
                OnClientItemsRequested="OnClientItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting" 
                EnableLoadOnDemand="true" OnClientDropDownClosed="OnClientDropDownClosed"   
                EnableItemCaching="true">  
                <ExpandAnimation Type="none" /> 
                <CollapseAnimation Type="none" /> 
                <WebServiceSettings Path="WebService.asmx"  Method="GetPCity" /> 
            </telerik:RadComboBox> 
            <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock4">  
                <script type="text/javascript">  
                    var startTime;  
                    var sendRequest = true;  
                    var calculate = false;  
                    function OnClientItemsRequesting(sender, args) {  
                        var input = $find('<%= DDlPCountry.ClientId %>');  
                        args.get_context()["Item"] = input.get_value();  
                        var input1 = $find('<%= DDlPState.ClientId %>');  
                        args.get_context()["Item1"] = input1.get_value();  
                        var context1 = $find('<%= DDlPCity.ClientId %>');  
                        args.get_context()["str"] = context1.get_value();  
                        startTime = new Date();  
                    }  
 
                    function OnClientItemsRequested(sender, args) {  
                    }  
 
                    function OnClientDropDownClosed(sender, args) {  
                        sender.clearItems();  
                        if (args.get_domEvent().stopPropagation)  
                            args.get_domEvent().stopPropagation();  
                    }  
                </script> 
            </telerik:RadScriptBlock> 
            </td> 
    </tr> 
    <tr> 
        <td class="style3">  
        </td> 
        <td> 
        </td> 
        <td class="style2">  
 
        </td> 
        <td> 
 
            <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
                ConnectionString="<%$ ConnectionStrings %>"   
                SelectCommand="SELECT [CountryID], [CountryName] FROM [CountryMaster] where Disabled=0">  
            </asp:SqlDataSource> 
 
        </td> 
    </tr> 
    <tr> 
        <td class="style3">  
        </td> 
        <td class="style1">  
        </td> 
        <td class="style2">  
 
        </td> 
        <td> 
            <asp:SqlDataSource ID="SqlDataSource2" runat="server"   
                    ConnectionString="<%$ ConnectionStrings %>"   
                    SelectCommand="SELECT [CountryID], [CountryName] FROM [CountryMaster] where Disabled=0">  
                </asp:SqlDataSource> 
 
        </td> 
    </tr> 
</table> 
</div>   
</body> 
0
Accepted
Kalina
Telerik team
answered on 25 Mar 2010, 07:56 AM
Hi prachi s,

I tried reproducing the issue on our side but without success.

While inspecting the code of the user control,  I noticed that you populate the related RadComboBoxes using JavaScript functions with the same names.
When there are functions with equal names on one page - only the last one of them will be executed.

You can rename JavaScript functions like this:

<telerik:RadComboBox ID="DDlState" runat="server"
    Width="175px" Height="200px" Skin="WebBlue"
    OnClientItemsRequested="OnClientItemsRequested"
    OnClientItemsRequesting="OnClientItemsRequesting"
    OnClientDropDownClosed="OnClientDropDownClosed"
    EnableLoadOnDemand="true"  EnableItemCaching="true"
    <ExpandAnimation Type="none" />
    <CollapseAnimation Type="none" />
    <WebServiceSettings Path="WebService.asmx"  Method="GetCountry"  />
</telerik:RadComboBox>
<telerik:RadScriptBlock runat="Server" ID="RadScriptBlock5"
    <script type="text/javascript"
        var startTime; 
        var sendRequest = true
        var calculate = false;
        function OnClientItemsRequesting(sender, args) { 
       
            var inp1 = $find('<%= DDlCountry.ClientID %>');
            args.get_context()["Item"] = input.get_value(); 
            var context2 = $find('<%= DDlState.ClientID %>');
            args.get_context()["str"] = context2.get_value();
            context2.requestItems();
            startTime = new Date(); 
        
 
        function OnClientItemsRequested(sender, args) { 
        }
 
        function OnClientDropDownClosed(sender, args) { 
       
            sender.clearItems(); 
            if (args.get_domEvent().stopPropagation) 
                args.get_domEvent().stopPropagation(); 
        
    </script>

<telerik:RadComboBox ID="DDlPState" runat="server"
    Width="175px" Height="200px" Skin="WebBlue"
    OnClientItemsRequested="POnClientItemsRequested"
    OnClientItemsRequesting="POnClientItemsRequesting"
    OnClientDropDownClosed="POnClientDropDownClosed"
    EnableLoadOnDemand="true"  EnableItemCaching="true"
    <ExpandAnimation Type="none" />
    <CollapseAnimation Type="none" />
    <WebServiceSettings Path="WebService.asmx"  Method="GetCountry"  />
</telerik:RadComboBox>
<telerik:RadScriptBlock runat="Server" ID="RadScriptBlock1"
    <script type="text/javascript"
        var startTime; 
        var sendRequest = true
        var calculate = false
        function POnClientItemsRequesting(sender, args) { 
            var input = $find('<%= DDlPCountry.ClientID %>'); 
            args.get_context()["Item"] = input.get_value(); 
            var context1 = $find('<%= DDlPState.ClientID %>');
            args.get_context()["str"] = context1.get_value();
            context2.requestItems();
            startTime = new Date(); 
        
 
        function POnClientItemsRequested(sender, args) { 
        
 
        function POnClientDropDownClosed(sender, args) { 
            sender.clearItems(); 
            if (args.get_domEvent().stopPropagation) 
                args.get_domEvent().stopPropagation(); 
        
    </script>
 
</telerik:RadScriptBlock>

Please let me know if this was helpful.

Greetings,
Kalina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
prachi s
Top achievements
Rank 1
answered on 02 Apr 2010, 06:56 AM
Thanks Kalina
it works,  thanks a lot :)
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
prachi s
Top achievements
Rank 1
Answers by
prachi s
Top achievements
Rank 1
Kalina
Telerik team
Share this question
or