Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
75 views
I am trying to update My City combobox when someone selects a state.  Will someone please look at my code and tell me why both my city and state comboboxes are blank?

I was following this tutorial:  http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultvb.aspx

Thanks!

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports Telerik.Web.UI
Partial Class _default
    Inherits System.Web.UI.Page
 
    Private Const MessageTemplate As String = "You chose to explore the city of {1} in {0}"
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
 
        If Not Page.IsPostBack Then
            ' Fill the continents combo.
            LoadStates()
        ElseIf Not Page.IsCallback Then
            ' On regular postbacks restore the items of the related ComboBoxes.
            ' Their selected items will be automatically restored from their ClientState.
            LoadStates()
            LoadCities(cbxStates.SelectedValue)
        End If
 
    End Sub
 
    Protected Sub LoadStates()
 
        Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionString").ConnectionString)
 
        Dim adapter As New SqlDataAdapter("SELECT * FROM States ORDER By StateName", connection)
        Dim dt As New DataTable()
        adapter.Fill(dt)
 
        cbxStates.DataTextField = "StateName"
        cbxStates.DataValueField = "StateID"
        cbxStates.DataSource = dt
        cbxStates.DataBind()
        ' Insert the first item.
        cbxStates.Items.Insert(0, New RadComboBoxItem("- Select a State -"))
 
    End Sub
 
    Protected Sub LoadCities(ByVal StateID As String)
 
        Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("DBConnectionString").ConnectionString)
 
        ' Select a country based on the continentID.
        Dim adapter As New SqlDataAdapter("SELECT * FROM Cities WHERE StateID=@StateID ORDER By Name", connection)
        adapter.SelectCommand.Parameters.AddWithValue("@StateID", StateID)
 
        Dim dt As New DataTable()
        adapter.Fill(dt)
 
        cbxCities.DataTextField = "CityName"
        cbxCities.DataValueField = "CityID"
        cbxCities.DataSource = dt
        cbxCities.DataBind()
 
    End Sub
 
    Protected Sub cbxStates_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs) Handles cbxStates.ItemsRequested
        LoadStates()
    End Sub
 
    Protected Sub cbxCities_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs) Handles cbxCities.ItemsRequested
        ' e.Text is the first parameter of the requestItems method
        ' invoked in LoadCountries method
        LoadCities(e.Text)
    End Sub
 
    Protected Sub Button1_Click(sender As Object, e As EventArgs)
        Literal1.Text = String.Empty
 
        If RadComboBox1.SelectedIndex > 0 Then
            Literal1.Text = String.Format(MessageTemplate, cbxStates.Text, cbxCities.Text)
        End If
    End Sub
 
End Class

<%@ Page Title="" Language="VB" MasterPageFile="~/sitemasterpage.master" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="_default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="main-content-container">
        <div id="home-container">
            <div id="home-search-text">
                <h2>Join for free and start searching...</h2>
                <p>Once you sign up, you're free to search our members and start finding your perfect match.</p>
                <div id="home-search-content">
                    <table cellpadding="2" class="home-search-table">
                        <tr>
                            <td>
                                I'm a
                            </td>
                            <td>
                                <telerik:RadComboBox ID="RadComboBox1" Runat="server" >
                                    <Items>
                                        <telerik:RadComboBoxItem runat="server" Selected="True" Text="Man" Value="Man" />
                                        <telerik:RadComboBoxItem runat="server" Text="Woman" Value="Woman" />
                                    </Items>
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr>
                            <td>Looking for a</td>
                            <td>
                                <telerik:RadComboBox ID="RadComboBox2" Runat="server" >
                                    <Items>
                                        <telerik:RadComboBoxItem runat="server" Text="Man" Value="Man" />
                                        <telerik:RadComboBoxItem runat="server" Selected="True" Text="Woman" Value="Woman" />
                                    </Items>
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr>
                            <td>Select your State</td>
                            <td>
                                <telerik:RadComboBox ID="cbxStates"
                                                     runat="server"
                                                     CssClass="ComboBox_Continents"
                                                     OnClientSelectedIndexChanging="LoadStates"
                                                     OnItemsRequested="cbxStates_ItemsRequested" />
                            </td>
                        </tr>
                        <tr>
                            <td>Select your City</td>
                            <td>
                                <telerik:RadComboBox ID="cbxCities"
                                                     runat="server"
                                                     CssClass="ComboBox_Continents"
                                                     OnClientSelectedIndexChanging="LoadCities"
                                                     OnItemsRequested="cbxCities_ItemsRequested" />
                            </td>
                        </tr>
                        <tr>
                            <td> </td>
                            <td>
                                <asp:Button ID="Button1" runat="server" Text="Explore"
                                            OnClick="Button1_Click" />
                                <asp:Literal runat="server" ID="Literal1"></asp:Literal>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        //global variables for the countries and cities comboboxes
        var StatesCombo;
        var citiesCombo;
 
        function pageLoad() {
            // initialize the global variables
            // in this event all client objects
            // are already created and initialized
            statesCombo = $find("<%= cbxStates.ClientID%>");
            citiesCombo = $find("<%= cbxCities.ClientID%>");
        }
 
        function LoadStates(sender, eventArgs) {
            var item = eventArgs.get_item();
            statesCombo.set_text("Loading...");
            citiesCombo.clearSelection();
 
            // if a continent is selected
            if (item.get_index() > 0) {
                // this will fire the ItemsRequested event of the
                // countries combobox passing the continentID as a parameter
                statesCombo.requestItems(item.get_value(), false);
            }
            else {
                // the -Select a continent- item was chosen
                statesCombo.set_text(" ");
                statesCombo.clearItems();
 
                citiesCombo.set_text(" ");
                citiesCombo.clearItems();
            }
        }
 
        function LoadCities(sender, eventArgs) {
            var item = eventArgs.get_item();
 
            citiesCombo.set_text("Loading...");
            // this will fire the ItemsRequested event of the
            // cities combobox passing the countryID as a parameter
            citiesCombo.requestItems(item.get_value(), false);
        }
 
        function ItemsLoaded(sender, eventArgs) {
            if (sender.get_items().get_count() > 0) {
                // pre-select the first item
                sender.set_text(sender.get_items().getItem(0).get_text());
                sender.get_items().getItem(0).highlight();
            }
 
            sender.showDropDown();
        }
    </script>
</asp:Content>
Nencho
Telerik team
 answered on 24 Aug 2012
3 answers
100 views
hello!

There is a way to control z-index of dialog opened by send mail button?
My menu it's displayed over this dialog.
Any idea?

Marin Bratanov
Telerik team
 answered on 24 Aug 2012
7 answers
155 views
Hi all,
I have a rad list view and a rad filter ... i need to reduce the menu option containing rad filter . so i have use the below java script and code.
Script
<script type="text/javascript">
          function FilterCreated(sender, eventArgs) {
              var filterMenu = sender.get_contextMenu();
              filterMenu.add_showing(FilterMenuShowing);
          }
          function FilterMenuShowing(sender, eventArgs) {
              var filter = $find("<%= RadFilter2.ClientID %>");
              var currentExpandedItem = sender.get_attributes()._data.ItemHierarchyIndex;
              sender.findItemByValue("Between").set_visible(false);
              sender.findItemByValue("DoesNotContain").set_visible(false);
              sender.findItemByValue("EndsWith").set_visible(false);
              sender.findItemByValue("GreaterThan").set_visible(false);
              sender.findItemByValue("GreaterThanOrEqualTo").set_visible(false);
              sender.findItemByValue("IsEmpty").set_visible(false);
              sender.findItemByValue("IsNull").set_visible(false);
              sender.findItemByValue("LessThan").set_visible(false);
              sender.findItemByValue("LessThanOrEqualTo").set_visible(false);
              sender.findItemByValue("NotBetween").set_visible(false);
              sender.findItemByValue("NotEqualTo").set_visible(false);
              sender.findItemByValue("NotIsEmpty").set_visible(false);
              sender.findItemByValue("NotIsNull").set_visible(false);
              sender.findItemByValue("And").set_visible(false);
              sender.findItemByValue("NotAnd").set_visible(false);
              sender.findItemByValue("NotOr").set_visible(false);
              sender.findItemByValue("Or").set_visible(false);
              }
          }
      </script>

Aspx
<telerik:RadFilter runat="server" ID="RadFilter2" FilterContainerID="RadListView1"
   ClientSettings-ClientEvents-OnFilterCreated="FilterCreated"
      ExpressionPreviewPosition="Bottom">
   <FieldEditors>
      <telerik:RadFilterTextFieldEditor FieldName="ItemName" DisplayName="ItemName" DataType="System.String" />
              <telerik:RadFilterTextFieldEditor FieldName="ItemCode" DisplayName="ItemCode" DataType="System.String" />
  </FieldEditors>
 </telerik:RadFilter>

Rad Ajax Update:
<telerik:AjaxSetting AjaxControlID="RadFilter2">
  <UpdatedControls>
     <telerik:AjaxUpdatedControl ControlID="RadListView1" LoadingPanelID="RadAjaxLoadingPanel1" />
      <telerik:AjaxUpdatedControl ControlID="RadFilter2" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
 </telerik:AjaxSetting>


Code
Protected Sub RadFilter2_AppyExpressions(ByVal sender As Object, ByVal e As RadFilterApplyExpressionsEventArgs)
       Dim provider As New RadFilterListViewQueryProvider(New List(Of RadFilterGroupOperation)())
       provider.ProcessGroup(e.ExpressionRoot)
       RadListView1.FilterExpressions.Add(provider.ListViewExpressions(0))
       RadListView1.Rebind()
   End Sub

 when i try to select the menu of the filter control that time am getting the error like "Microsoft JScript runtime error: Unable to get value of the property 'set_visible': object is null or undefined"

Please fix my issue... 

Regards,

Prassin

Pavlina
Telerik team
 answered on 24 Aug 2012
1 answer
71 views
Hi Friends,

My requirement is this:

Existing Functionality:
 After SpellCheck RadEditor is not editable.

New Requirements:
 After SpellCheck RadEditorshould be editable.

Please help on this. Its urgent.


Marin Bratanov
Telerik team
 answered on 24 Aug 2012
13 answers
403 views

How do you create cascading Dropdown for Resource Type. We have two resources added to appoint. Class and teacher. We want during time of creation of appointment. When user selects class. The teacher drop down should filter the data and show only teacher for that class. We are using Linqdatasource

question 1: For teacher Linqsource how can we pass parameter as class dropdown control value.
question 2: How can we define on selected index change event for dropdown class.
question 3: How can you make teacher dropdown invisible as default. and make it visible on selected index change event of Class dropdown.

 

 

Peter
Telerik team
 answered on 24 Aug 2012
1 answer
62 views
Hello,
I'm using grid with self-referencing hierarchy based on this example: http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/selfreferencing/defaultcs.aspx.

I would like to put all items that do not have children in edit mode (InPlace) to let user set the amount of requested products in the textbox.

I tried solutions from http://www.telerik.com/help/aspnet-ajax/grid-put-all-items-in-edit-mode-no-additional-rebind.html, but to no avail.

The first method works fine for normal grid, but in that case (for grid with hierarchy) it allows to edit only root nodes (and makes expanding impossible). 

Is there something I can do? Or maybe there is other control to display hierarchy (like treelist) which allows to use textbox? Because I need to display tree of products and allow user to choose which and how many products he wants.

Thank you in advance
Tsvetina
Telerik team
 answered on 24 Aug 2012
3 answers
134 views
Hi,
I want to change the align the button in radalert using stylysheet. Code is :

 <style type="text/css">       
        .rwPopupButton
        {
           margin:10px 0px 0px 140px !important;
        }
    </style>

But it also affected to radconfirm buttons. 
So,Please help me for this to only change the align of radalert  not any other window buttons.

Thanks
Marin Bratanov
Telerik team
 answered on 24 Aug 2012
14 answers
266 views
Hope you guys can help.

I need to use the Rad Editor control in a custom Sharepoint 2010 web part which also contains a whole application with multiple views. I can't use the web part version of Rad Editor, it has to be the .NET control. I tried doing some searches for instructions on how to do this in a Visual Studio 2010 Visual Web Part solution (which is what this application is), but cannot find anything on how to setup and configure the Rad Editor so I can work with it in my layout in the IDE.

When I try to drop the Rad Editor control into a DIV on my web part surface (in design mode), I get a simple tag for the control and (in the display view) an error saying "Error Creating Panel: Could not find file 'C:\...\...\web.config'. Well, at design time, I don't have a web.config. So what am I to do?

Can someone please help - with steps and configuration settings - so I can stay on track with the project? The Rad Editor is the reason we chose Telerik for this project in the first place.

Thanks for all help (and snippets) in advance!
A
Stanimir
Telerik team
 answered on 24 Aug 2012
1 answer
94 views
I have been trying to make a few simple modifications to a TreeView with the new touch skin.

I see where spacing is larger to account for fingers rather than mouse tip, but the horizontal indents for a three-level node expansion are excessive for my applications. Bear in mind it is the width of the indent that I am concerned about, otherwise the skin works extremely well on my iPad, Android tablet and Windows Phone. (Yeah Telerik!)

Per the demos, I have applied custom CSS to the nodes. Using a text-indent value of -16px does the trick for the text.

However the hot-spot does not move.

I am thinking there must be some pre-defined override that I can apply, similar to a customization provided elsewhere for RadGrid, as below. Can anyone point me in the right direction? And what property would affect the hot-spot?

 

<style type="text/css">     
 div.RadGrid .rgPager .rgAdvPart    
 {    
  display:none;       
 }
Ivan Zhekov
Telerik team
 answered on 24 Aug 2012
1 answer
82 views
When I create and ItemTemplate for the RadMenu, there are quotes put around the title. For example, Home whould display as "Home".

DataSource
<asp:SiteMapDataSource
    ID="SiteMapDataSourceMasterPage"
    runat="server"
    ShowStartingNode="false"
    StartingNodeOffset="0" />

RadMenu
<telerik:RadMenu
    ID="RadMenuMasterPage"
    runat="server"
    AllowSorting="True"
    CellSpacing="0"
    DataSourceID="SiteMapDataSourceMasterPage">
 
    <ItemTemplate>
        <div>
            <a href="<%# DataBinder.Eval(Container.DataItem, "url") %>">
                <%# DataBinder.Eval(Container.DataItem, "description") %>"
            </a>
        </div>
    </ItemTemplate>
 
</telerik:RadMenu>

Code Behind Page_Load
for (int i = 0; i < RadMenuMasterPage.Items.Count; i++)
{
    RadMenuMasterPage.Items[i].DataBind();
}

Thanks!
Kevin
Top achievements
Rank 2
 answered on 24 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?