RadComboBox for ASP.NET AJAX SelectedIndexchanged issue

3 posts, 0 answers
  1. Mohamed
    Mohamed avatar
    2 posts
    Member since:
    Jan 2011

    Posted 09 Jun 2011 Link to this post

    Hello Telerik Team

    Currently I'm using RadControl version : 2011.1.315.35 (for ASP.NET AJAX). After doing research a lot on this forum and the Internet, I still can not solve my issue so I post here.

    My ASPX file :

    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/DownloadCenter.Master" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="DownloadCenter.GUI.Test" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="contentPage" runat="server">
     
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
     
    <telerik:RadComboBox ID="rd" runat="server"
                EnableLoadOnDemand="True"
                DataTextField="Desc"
                DataValueField="PayID"
                OnItemsRequested="RadComboBox1_ItemsRequested"
                AutoPostBack="True"
                onselectedindexchanged="rd_SelectedIndexChanged"
                >
            </telerik:RadComboBox>
    </asp:Content>

    My code behind looks like
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using DownloadCenter.Entity;
    using Telerik.Web.UI;
     
    namespace DownloadCenter.GUI
    {
        public partial class Test : System.Web.UI.Page
        {
            BO bo = new BO();
            DB db = new DB();
            User user;
     
     
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    BindRD();
                }
            }
     
            private void BindRD()
            {
                rd.DataSource = db.GetPayMethod_CB();
                rd.DataBind();
            }
     
            protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
            {
                rd.DataSource = db.GetPayMethod_CB();
                rd.DataBind();
               
            }
     
            protected void rd_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
            {
                string tt = rd.SelectedValue.ToString();
     
                Session["SupplierID"] = e.Value;
            }
     
            
        }

    The very first issue I face is : when I select "aaa" the comboBox will automatically select "bbb". But this issue i already resolved by using
    <script language="javascript">
     
        function onBlur(comboBox) {
            comboBox.OriginalText = comboBox.GetText();
        }
    </script>

    Now when I select "aaa" it will display "aaa" but I don't know why the SelectedIndexChanged event won't fire.
    Please notice that
                DataTextField="Desc"
                DataValueField="PayID"

    has unique value and it differs from other field.

    I already follow many work around here but i still can make it.
    Please help me out.
    Many thanks in advance

    Regards
    Pasha

  2. Mohamed
    Mohamed avatar
    2 posts
    Member since:
    Jan 2011

    Posted 12 Jun 2011 Link to this post

    Anybody here? 25 views and no one helps. Why ?
  3. Cat Cheshire
    Cat Cheshire avatar
    128 posts
    Member since:
    Jun 2010

    Posted 14 Jun 2011 Link to this post

    I was not able to find where you use the onBlur function in your code - maybe you handle OnClientBlur event?

    Have you debugged your code - does the page rise a postback after you change the selected item?

    Are there any javascript errors on your page?

Back to Top