Telerik Forums
UI for ASP.NET AJAX Forum
14 answers
1.0K+ views
Hi All

I have three rad combo box in my form, countries, states and cities.

When a country is selected its states should be loaded into the states list and so when a state is selected its cities should be loaded into the cities list.

i want to do this using client side APIs

after searching your form i found an solution and apply it as the following code:-

my form source 
  
<table>
 <tr>
              <td class="RC1"  style="width:10%;">
                 <asp:Label ID="lblCountry" runat="server" ></asp:Label>
              </td>
              <td style="width:90%;" class="RC2">
                  <telerik:RadComboBox ID="lstCountries" Runat="server" Width="200px" 
                    Filter="StartsWith" onclientdropdownopening="DropDownOpening" ValidationGroup="ValAddressInfo"  OnClientSelectedIndexChanged="loadStates">
                   </telerik:RadComboBox>
                   <asp:RequiredFieldValidator ID="reqCountry" runat="server" 
                           ControlToValidate="lstCountries" CssClass="Validator"  ValidationGroup="ValAddressInfo">*</asp:RequiredFieldValidator>
               </td>
            </tr>
            <tr>
             <td class="RC1" style="width:20%;" >
               <asp:Label ID="lblStates" runat="server"  ></asp:Label>
             </td>
             <td class="RC2" style="width:80%;">
                 <telerik:RadComboBox ID="lstStates" Runat="server"  
                      Width="200px" 
                     Filter="StartsWith" onclientdropdownopening="DropDownOpening" 
                     OnClientSelectedIndexChanged="loadCities"  
                     onitemsrequested="lstStates_ItemsRequested" OnClientItemsRequesting="statesItemRequesting"  EnableLoadOnDemand ="true" >
                      <CollapseAnimation Type="OutQuint" Duration="200" />  
                 </telerik:RadComboBox>
            </tr>
            <tr>
              <td class="RC1" style="width:20%;">
                <asp:Label ID="lblCities" runat="server" ></asp:Label>
              </td>
              <td class="RC2" style="width:80%;">
                 <telerik:RadComboBox ID="lstCities" Runat="server"  Width="200px" Filter="StartsWith" onclientdropdownopening="DropDownOpening" onitemsrequested="lstCities_ItemsRequested" OnClientItemsRequesting="citiesItemRequesting"  EnableLoadOnDemand ="true"  >
                </telerik:RadComboBox>
              </td>
            </tr>
</table>

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
  <script type="text/javascript" language="javascript">
           function loadStates(sender, args) {       
            var listStates = $find("<%=lstStates.ClientID %>");           
              
            var item = args.get_item();   
     
            if (item.get_index() > 0)   
            {
                listStates.requestItems(item.get_value(), false);                  
             }   
            else   
            {   
            }
  
        }
  
        function statesItemRequesting(sender, args) {
            var lst1 = $find("<%=lstCountries.ClientID %>");
            var context = args.get_context();
            context["country_code"] = lst1.get_selectedItem().get_value();
        }
  
        function loadCities(sender, args) {
            var listCities = $find("<%=lstCities.ClientID %>");
  
            var item = args.get_item();
  
            if (item.get_index() > 0) {
                listCities.requestItems(item.get_value(), false);
            }
            else {
            }
        }
  
        function citiesItemRequesting(sender, args) {
            var lst1 = $find("<%=lstCountries.ClientID %>");
            var lst2 = $find("<%=lstStates.ClientID %>");
            var context = args.get_context();
            context["country_code"] = lst1.get_selectedItem().get_value();
            context["state_code"] = lst2.get_selectedItem().get_value();
        }
  
      
         
  
  
   </script>
</telerik:RadScriptBlock>

in the code behind
  
protected void lstStates_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
  
{
  
int iCountryCode = Convert.ToInt32(Convert.ToInt32(e.Context["country_code"]));
  
bindList(iCountryCode,0,lstStates,2);
  
}
  
protected void lstCities_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
  
{
  
int iCountryCode = Convert.ToInt32(Convert.ToInt32(e.Context["country_code"]));
  
int iStateCode = Convert.ToInt32(Convert.ToInt32(e.Context["state_code"]));
  
bindList(iCountryCode, iStateCode, lstCities, 3);
  
}
 and the bindList is where i get the data from data base tables and fill it in the lists.

all are ok,,,,


BUT

i noticed that when i try to open the states combo box for example, it sticks then i should click any where in the form then try again to open it again so the items appear...

all functions are called and executed and the lists are filled...

but what is the reson for this behaviour?
this can ne be acceptable since the user may think that the list is stuck!!!

please help

asaad

Boyan Dimitrov
Telerik team
 answered on 28 Mar 2013
7 answers
291 views
It appears that the clientside may be lacking this functionality or it's just not documented anywhere that I can find. If I have the index of the RotatorItem that I want to display in the rotator, how to do I tell the rotator to go to that specific item using javascript. I have multiple rotators on a page and I want to be able to make them all rotate to the same item when the user selects a different value in the drop down list. The one hang up is just getting them to go to the selected value.$0$0$0$0Thanks,$0$0Adam$0
Slav
Telerik team
 answered on 28 Mar 2013
1 answer
319 views
Dear All/Support Team,

I have requirement to display record in a telerik grid with one column as View with Icon. on click view icon it open the edit form and render the  required control with two button as per the code given below. ie Inser/Update and Cancel button.

Now I am bale to either disable and enable the control on load, but I want to enable all the control in edit form on clicking the buttons(ie adding Edit button in the form). if I have to add Edit button as per my requirement in the following code, how to enable all control with client side code and avoid server side post back. How Edit button command event is set to none instead of  CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' or
 / CommandName="Cancel"


<td align="left" colspan="3">
    <asp:ImageButton ID="btnInsert" runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'
        ImageUrl="~/Images/Update.gif" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
        ToolTip="Save To Grid" ValidationGroup="ValDecision" /> 
    <asp:ImageButton ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel"
        ImageUrl="~/Images/Cancel.gif" ToolTip="Cancel" />
</td>

Kindly guide me on the same

With Regards
Palanivelrajan
Kostadin
Telerik team
 answered on 28 Mar 2013
1 answer
126 views

Hello Techies,

I am new to this forum. This is Sree. I work on SharePoint 2010.

We developed a user controls which queries the data from SharePoint library and bind the result into RadGrid.

Here the problem is when search query returns more than 15000 records; it takes too much time to bind the result into RadGrid and finally end up with timeout error (attached snapshot). Sometimes the page gets hung and the only option we have is to close the browser.

Is there any recommended item limit for RadGrid to avoid these issues?

As per my requirement my search query always returns more than 20000 records(may increase to a lack in future) and I can’t suggest users to put more refinement to get few results so that I can avoid these problems.

I certainly need your valuable advice's on this to overcome such scenarios?

Thanks in advance

Sree

Angel Petrov
Telerik team
 answered on 28 Mar 2013
3 answers
263 views
hi,
I have  more than one rad text box which is multiline and one Radgrid in my page .
When i press enter in any text box, delete command of Radgrid is getting fired which i don't want.
I tried writing a code for not accepting enter key press event but it is also applying to text box which are multiline.
I want enter key to be present in text box but it should not fire any other events of Radgrid.
Please help me. 
Daniel
Telerik team
 answered on 28 Mar 2013
4 answers
147 views
Well the pictures show the problem...when i load the program it does not show the buttons as i wish it to be

Best regards
Rafael
Rafael
Top achievements
Rank 1
 answered on 28 Mar 2013
2 answers
1.2K+ views
Hi  We are using rad combo box.
It works fine while adding record on

OnClientItemsRequested event.

Now I want remove one or many items form the combobox. So I wrote code on client blur event. 
the code is executed properly but when combobox dropdown opens it shows me deleted Item.

the requirement is after on blur and before dropdown opening I want to delete/ remove one or many items from combobox

Kindly suggest me the solution to achieve above requirement.

Below is the code which I wrote onClientblurEvent

var errItem = new Telerik.Web.UI.RadComboBoxItem();
    errItem = sender.findItemByText("ABCD")
    if (errItem) {
        sender.clearSelection();
        sender.clearItems();
        sender.trackChanges();
        sender.get_items().remove(errItem);
        sender.commitChanges();
    }

    errItem = sender.findItemByText("XYZ")
    if (errItem) {
        sender.clearSelection();
        sender.clearItems();
        sender.trackChanges();
        sender.get_items().remove(errItem);
        sender.commitChanges();
    }

 
Amit
Top achievements
Rank 1
 answered on 28 Mar 2013
1 answer
122 views
Hi folks,

I've got a RadGrid with a LinqDataSource and a WebUserControl as EditForm, much like the example http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/linqdatasource/defaultcs.aspx.

I have some custom code in my WebUserControl which makes it impossible for me to switch to another EditFormType.

Now I need to add a File Upload to the EditForm. Of course just adding a normal FileUpload (asp:FileUpload aswell as telerik:RadUpload) doesn't work because there are no postbacks in the EditForm UserControl.

In the examples (http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/gridattachmentcolumn/defaultcs.aspx) I find a <telerik:GridAttachmentColumn> which would be great if I were using an automatically generated EditForm, but doesn't help me with my EditForm.

Is there any way I can put a file upload in my UserControl EditForm? Any suggestions for a workaround?

Cheers
Angel Petrov
Telerik team
 answered on 28 Mar 2013
3 answers
155 views
I'm a little new to using the Telerik Ajax stuff, so maybe there is a completely different method for what I want to do, but...

Using a standard RadAjaxManager and RadAjaxPanel, is there any way to send/return extra information to/from the server without having a specific control defined to hold the extra data (i.e. asp:HiddenField).

I've used jQuery before to call WebMethods and I can return whatever I like in the JSON, even if I don't use it to update my page. But in this instance, I have an app that is already using the aforementioned RadAjaxManger and RadAjaxPanel to insert/update/delete data in a database, but I would like to return some metadata that I can use to determine if the operations occurred without issue (mainly validation issues). But I was hoping there was a better way than created N number of asp:HiddenFields for each and every RadAjaxPanel that exist in the app.

So is there any way to do what I'm asking?


P.S. How is it that these Telerik Ajax operations can happen without WebMethod being specified? Is the page doing a full postback with all the page data (i.e. ViewState) in it, but just returned the pieces that were supposed to get updated?
Antonio Stoilkov
Telerik team
 answered on 28 Mar 2013
1 answer
147 views
Dear,
For RadSearchBox binded to ObjectDataSource seems OnSearch event give back proper data (e.Value) only in case when item from the searchBox dropdown is clicked.

Rest two triggers for this event, mean  search button  click or  Enter pressed always give back null in e.Value

Did you notice similar?
best regarsd robert
Plamen
Telerik team
 answered on 28 Mar 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?