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

combobox SelectedIndexChanged event not fired intially when i ajaxify that control for showing progressbar

5 Answers 152 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Chalam
Top achievements
Rank 1
Chalam asked on 01 Feb 2012, 08:53 AM
combobox SelectedIndexChanged event not fired intially when i ajaxify that control for showing progressbar ,but it fired when click another combobox in same page(after progressbar stoped) so plz help me


thanks in advance

5 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 01 Feb 2012, 06:29 PM
Hi Bolupadra,

In order to make a post-back to the server, on selected index changed, RadComboBox needs its property AutoPostBack to be set to true.

Could you provide me with the code (the server code and the markup)  that is causing this behavior?

Greetings,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Chalam
Top achievements
Rank 1
answered on 02 Feb 2012, 06:48 AM
thanks for reply  i have already put autopostback property as true for all comboboxes but it's not working,

this is my ASPX

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>

   <telerik:RadWindowManager ID="RadWindowManager1" runat ="server" ></telerik:RadWindowManager>
    <telerik:RadAjaxManager runat="server">
    <AjaxSettings>
     <telerik:AjaxSetting AjaxControlID ="RadComboBox1" EventName ="SelectedIndexChanged">
    <UpdatedControls >
   <%-- <telerik:AjaxUpdatedControl ControlID ="RadAjaxLoadingPanel1" />--%>
    <telerik:AjaxUpdatedControl ControlID ="RadComboBom1" LoadingPanelID ="RadAjaxLoadingPanel1" />
    <telerik:AjaxUpdatedControl ControlID ="RadComboBox2" LoadingPanelID="RadAjaxLoadingPanel1" />
    <telerik:AjaxUpdatedControl ControlID ="Button1" />
    </UpdatedControls>
    </telerik:AjaxSetting>
    <telerik:AjaxSetting AjaxControlID ="Button1">
    <UpdatedControls >
    <telerik:AjaxUpdatedControl ControlID ="Button1" LoadingPanelID ="RadAjaxLoadingPanel1" />
    <telerik:AjaxUpdatedControl ControlID ="RadGrid1" />
    </UpdatedControls>
    </telerik:AjaxSetting>
    <telerik:AjaxSetting AjaxControlID ="RadGrid1">
    <UpdatedControls>
    <telerik:AjaxUpdatedControl ControlID ="RadGrid1" LoadingPanelID ="RadAjaxLoadingPanel1" />
    <telerik:AjaxUpdatedControl ControlID ="Button1" />
    <telerik:AjaxUpdatedControl ControlID ="RadComboBox2" />
    <telerik:AjaxUpdatedControl ControlID ="RadTextBox2" />
    <telerik:AjaxUpdatedControl ControlID ="RadTextBox3" />
    </UpdatedControls>
    </telerik:AjaxSetting>
    </AjaxSettings>
    </telerik:RadAjaxManager>


    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Vista" IsSticky ="True" CssClass ="loadingpanel">
        <%--<img src="images/loading.gif" alt="" />--%>
    </telerik:RadAjaxLoadingPanel>
         
    <table class="style1">

      
        <tr>
          
            <td>
                <telerik:RadComboBox ID="RadComboBox1" Runat="server"
                    AutoPostBack="True" MarkFirstMatch="True" Width="204px" DropDownWidth="250px" Height="200px"
                    Skin="Web20" AppendDataBoundItems="True" EnableLoadOnDemand="True">
                </telerik:RadComboBox>
            </td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                Name</td>
            <td>
                <telerik:RadComboBox ID="RadComboBox2" Runat="server"
                    AutoPostBack="True" MarkFirstMatch="True" Width="204px" DropDownWidth="250px" Height="200px"
                    Skin="Web20" AppendDataBoundItems="True" EnableLoadOnDemand="True">
                </telerik:RadComboBox>
            </td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                Age</td>
            <td>
                <telerik:RadTextBox ID="RadTextBox2" Runat="server" Width="180px">
                </telerik:RadTextBox>
            </td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                Address</td>
            <td>
                <telerik:RadTextBox ID="RadTextBox3" Runat="server" Width="180px">
                </telerik:RadTextBox>
            </td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button1" runat="server" Text="Search" />
                &nbsp;&nbsp;
                </td>
        </tr>
        <tr>
            <td class="style3" colspan="3">
                <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
                    GridLines="None" PageSize="7"
                    Skin="Web20" Width="949px" AllowPaging="True"
                    AllowFilteringByColumn="True" AllowSorting="True" ShowGroupPanel="True">
                 
       <MasterTableView >
         <Columns >
         <telerik:GridEditCommandColumn ButtonType ="ImageButton" HeaderText ="Edit" >      
         </telerik:GridEditCommandColumn>
         <telerik:GridBoundColumn DataField ="id" HeaderText="id" UniqueName="id" >
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn HeaderText="Name" DataField ="name" UniqueName="name" >
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn HeaderText="pwd" UniqueName="pwd" DataField ="pwd" >
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn HeaderText="mobile" UniqueName="mobile" DataField ="mobile">
         </telerik:GridBoundColumn>
    </Columns>

<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn"></EditColumn>
</EditFormSettings>
</MasterTableView>
 <ClientSettings AllowDragToGroup="True" EnableRowHoverStyle="True">
 <Selecting AllowRowSelect="true" />
                                </ClientSettings>
                </telerik:RadGrid>
            </td>
        </tr>
           </table>
    
 
    </form>

without using the AjaxSettings  all are working fine but after using AjaxSettings the comboboxes are not populate values

Hear My .VB is



  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack <> True Then
            RadComboBox1.Text = "Select"
            loadcombo()
            RadGrid1.Visible = False

        End If
    End Sub
    Protected Sub loadgrid()
        con.Open()
        Dim cmd As New MySqlCommand("select id,name,pwd,mobile from employee where id='" + RadComboBox1.SelectedItem.Text + "'", con)
        Dim da As New MySqlDataAdapter(cmd)
        Dim ds As New DataSet
        da.Fill(ds)
        RadGrid1.DataSource = ds
        RadGrid1.DataBind()
        RadGrid1.Visible = True
        con.Close()
    End Sub
    Protected Sub loadcombo()

        System.Threading.Thread.Sleep(2000)
        con.Open()
        Dim cd As New MySqlCommand("select distinct id from employee ", con)
        Dim adp As New MySqlDataAdapter(cd)
        Dim ds As New DataSet
        adp.Fill(ds)
        RadComboBox1.DataSource = ds
        RadComboBox1.DataTextField = "id"
        RadComboBox1.DataValueField = "id"
        RadComboBox1.DataBind()
        con.Close()

    End Sub
    Protected Sub loadcombo1()
        con.Open()
        Dim combo As New MySqlCommand("select name from employee where id='" + RadComboBox1.SelectedItem.Text + "'", con)
        Dim ad1 As New MySqlDataAdapter(combo)
        Dim ds1 As New DataSet
        ad1.Fill(ds1)
        RadComboBox2.DataSource = ds1
        RadComboBox2.Items.Clear()
        RadComboBox2.DataTextField = "name"
        RadComboBox2.DataValueField = "name"
        RadComboBox2.DataBind()
        con.Close()
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        System.Threading.Thread.Sleep(2000)

        If RadComboBox1.SelectedIndex > 0 Then
            loadgrid()

        Else
            con.Open()
            Dim cm As New MySqlCommand("select * from employee where id='" + RadComboBox1.SelectedItem.Text + "'", con)
            Dim dap As New MySqlDataAdapter(cm)
            Dim dss As New DataSet
            dap.Fill(dss)
            RadGrid1.DataSource = dss
            RadGrid1.DataBind()
            RadGrid1.Visible = True
            con.Close()
        End If

    End Sub

    Protected Sub RadGrid1_EditCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.EditCommand

        System.Threading.Thread.Sleep(2000)

        e.Item.Edit = False
        Dim index As Integer = e.Item.ItemIndex
        Session("ID") = RadGrid1.Items(index).Item("id").Text
        RadComboBox1.Text = RadGrid1.Items(index).Item("id").Text.Replace("&nbsp;", "")
        RadComboBox2.Text = RadGrid1.Items(index).Item("name").Text.Replace("&nbsp;", "")
        RadTextBox2.Text = RadGrid1.Items(index).Item("pwd").Text.Replace("&nbsp;", "")
        RadTextBox3.Text = RadGrid1.Items(index).Item("mobile").Text.Replace("&nbsp;", "")
    End Sub

 
    Protected Sub RadComboBox1_SelectedIndexChanged(o As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles RadComboBox1.SelectedIndexChanged
        System.Threading.Thread.Sleep(2000)
        RadComboBox2.Text = "Select"
        loadcombo1()
    End Sub

    Protected Sub RadGrid1_NeedDataSource(source As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        System.Threading.Thread.Sleep(1000)
        If Not Session("GRDSEARCH") Is Nothing Then
            RadGrid1.DataSource = CType(Session("GRDSEARCH"), DataTable)
        End If
    End Sub
End Class

so plz help me

thanks in advance
0
Chalam
Top achievements
Rank 1
answered on 02 Feb 2012, 06:50 AM

0
Ivana
Telerik team
answered on 06 Feb 2012, 02:53 PM
Hi,

The issues might be caused by the syntax error RadComboBom1 which should be RadComboBox1:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadComboBox1" EventName="SelectedIndexChanged">
            <UpdatedControls>
                <%-- <telerik:AjaxUpdatedControl ControlID ="RadAjaxLoadingPanel1" />--%>
                <telerik:AjaxUpdatedControl ControlID="RadComboBom1" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="RadComboBox2" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="Button1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="Button1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Button1" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="Button1" />
                <telerik:AjaxUpdatedControl ControlID="RadComboBox2" />
                <telerik:AjaxUpdatedControl ControlID="RadTextBox2" />
                <telerik:AjaxUpdatedControl ControlID="RadTextBox3" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" MarkFirstMatch="True"
    Width="204px" DropDownWidth="250px" Height="200px" Skin="Web20" AppendDataBoundItems="True"
    EnableLoadOnDemand="True">
</telerik:RadComboBox>

I hope this helps.

Greetings,
Ivana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Chalam
Top achievements
Rank 1
answered on 07 Feb 2012, 12:28 PM
Thanks for reply
i have modify that ID but still it's not working once again i have to explain my problem is the ComboBox2 is loads with some data based on selecting ComboBox1 with showing progressbar

Hear My SourceCode is

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>

   <telerik:RadWindowManager ID="RadWindowManager1" runat ="server" ></telerik:RadWindowManager>
    <telerik:RadAjaxManager runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadComboBox1" EventName ="SelectedIndexChanged">
                <UpdatedControls>
                 <telerik:AjaxUpdatedControl ControlID="RadAjaxLoadingPanel1" />
                  <telerik:AjaxUpdatedControl ControlID="RadComboBox1"
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox2"
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
               
    </telerik:RadAjaxManager>


    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Vista" IsSticky ="True" CssClass ="loadingpanel">
      
    </telerik:RadAjaxLoadingPanel>
         
    <table class="style1">

      
        <tr>
            <td class="style4">

                &nbsp;</td>
            <td class="style2">
                Id</td>
            <td>
                <telerik:RadComboBox ID="RadComboBox1" Runat="server"
                    AutoPostBack="True" MarkFirstMatch="True" Width="204px" DropDownWidth="250px" Height="200px"
                    Skin="Web20" AppendDataBoundItems="True" EnableLoadOnDemand="True">
                </telerik:RadComboBox>
            </td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                Name</td>
            <td>
                <telerik:RadComboBox ID="RadComboBox2" Runat="server"
                    AutoPostBack="True" MarkFirstMatch="True" Width="204px" DropDownWidth="250px" Height="200px"
                    Skin="Web20" AppendDataBoundItems="True" >
                </telerik:RadComboBox>
            </td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                Age</td>
            <td>
                <telerik:RadTextBox ID="RadTextBox2" Runat="server" Width="180px">
                </telerik:RadTextBox>
            </td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                Address</td>
            <td>
                <telerik:RadTextBox ID="RadTextBox3" Runat="server" Width="180px">
                </telerik:RadTextBox>
            </td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style2">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button1" runat="server" Text="Search" />
                &nbsp;&nbsp;
                </td>
        </tr>
        <tr>
            <td class="style3" colspan="3">
                
                <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
                    GridLines="None" PageSize="7"
                    Skin="Web20" Width="949px" AllowPaging="True"
                    AllowFilteringByColumn="True" AllowSorting="True" ShowGroupPanel="True">
                 
       <MasterTableView >
         <Columns >
         <telerik:GridEditCommandColumn ButtonType ="ImageButton" HeaderText ="Edit" >      
         </telerik:GridEditCommandColumn>
         <telerik:GridBoundColumn DataField ="id" HeaderText="id" UniqueName="id" >
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn HeaderText="Name" DataField ="name" UniqueName="name" >
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn HeaderText="pwd" UniqueName="pwd" DataField ="pwd" >
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn HeaderText="mobile" UniqueName="mobile" DataField ="mobile">
         </telerik:GridBoundColumn>
    </Columns>

<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn"></EditColumn>
</EditFormSettings>
</MasterTableView>
 <ClientSettings AllowDragToGroup="True" EnableRowHoverStyle="True">
 <Selecting AllowRowSelect="true" />
                                </ClientSettings>
                </telerik:RadGrid>
            </td>
        </tr>
    </table>
    
 
    </form>



Hear My VB is

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack <> True Then
            RadComboBox1.Text = "Select"
            loadcombo()
            RadGrid1.Visible = False

        End If
    End Sub
    'Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles RadGrid1.PreRender
    '    If RadGrid1.SelectedItems.Count = 0 Then
    '        RadGrid1.Items(0).Selected = True
    '    End If
    'End Sub
    'Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
    '    If RadComboBox1.SelectedIndex = 0 Then
    '        RadComboBox1.SelectedIndex.

    '    End If
    'End Sub
    Protected Sub loadgrid()
        con.Open()
        Dim cmd As New MySqlCommand("select id,name,pwd,mobile from employee where id='" + RadComboBox1.SelectedItem.Text + "'", con)
        Dim da As New MySqlDataAdapter(cmd)
        Dim ds As New DataSet
        da.Fill(ds)
        Session("Chalam") = ds
        RadGrid1.DataSource = ds
        RadGrid1.DataBind()
        RadGrid1.Visible = True
        con.Close()
    End Sub
    Protected Sub loadcombo()

        System.Threading.Thread.Sleep(2000)
        con.Open()
        Dim cd As New MySqlCommand("select distinct id from employee ", con)
        Dim adp As New MySqlDataAdapter(cd)
        Dim ds As New DataSet
        adp.Fill(ds)
        RadComboBox1.DataSource = ds
        RadComboBox1.DataTextField = "id"
        RadComboBox1.DataValueField = "id"
        RadComboBox1.DataBind()
        con.Close()

    End Sub
    Protected Sub loadcombo1()
        con.Open()
        Dim combo As New MySqlCommand("select name from employee where id='" + RadComboBox1.SelectedItem.Text + "'", con)
        Dim ad1 As New MySqlDataAdapter(combo)
        Dim ds1 As New DataSet
        ad1.Fill(ds1)
        RadComboBox2.DataSource = ds1
        RadComboBox2.Items.Clear()
        RadComboBox2.DataTextField = "name"
        RadComboBox2.DataValueField = "name"
        RadComboBox2.DataBind()
        con.Close()
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        System.Threading.Thread.Sleep(2000)

        If RadComboBox1.SelectedIndex > 0 Then
            loadgrid()

        Else
            con.Open()
            Dim cm As New MySqlCommand("select * from employee where id='" + RadComboBox1.SelectedItem.Text + "'", con)
            Dim dap As New MySqlDataAdapter(cm)
            Dim dss As New DataSet
            dap.Fill(dss)
            RadGrid1.DataSource = dss
            RadGrid1.DataBind()
            RadGrid1.Visible = True
            con.Close()
        End If

    End Sub

    Protected Sub RadGrid1_EditCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.EditCommand
        System.Threading.Thread.Sleep(2000)
        e.Item.Edit = False
        Dim index As Integer = e.Item.ItemIndex
        RadComboBox1.Text = RadGrid1.Items(index).Item("id").Text.Replace("&nbsp;", "")
        RadComboBox2.Text = RadGrid1.Items(index).Item("name").Text.Replace("&nbsp;", "")
        RadTextBox2.Text = RadGrid1.Items(index).Item("pwd").Text.Replace("&nbsp;", "")
        RadTextBox3.Text = RadGrid1.Items(index).Item("mobile").Text.Replace("&nbsp;", "")

    End Sub


    Protected Sub RadComboBox1_SelectedIndexChanged(o As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles RadComboBox1.SelectedIndexChanged
        System.Threading.Thread.Sleep(2000)
        RadComboBox2.Text = "Select"
        RadTextBox2.Text = ""
        RadTextBox3.Text = ""
        loadcombo1()
    End Sub

    Protected Sub RadGrid1_NeedDataSource(source As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        System.Threading.Thread.Sleep(1000)
        If Not Session("Chalam") Is Nothing Then
            RadGrid1.DataSource = CType(Session("Chalam"), DataSet)
        End If
    End Sub
End Class

Plz help me
Thanks in advance
Tags
ComboBox
Asked by
Chalam
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Chalam
Top achievements
Rank 1
Share this question
or