hi at all
i have a problem with rad combobox events on radgrid .
i have two radcombobox in a column template on a radgrid,
when a change the selected item in the firts radcombobox
the elements of the second radcombobox must be change.
I did it, but only works when the grid is in editmode,
but not when the grid created a new item , what can i do what's wrong in my code.
(i'am usig radcontrols 2008 q1,vs2005 and vb)
this is my code from server side
this is my code from the client side
i have a problem with rad combobox events on radgrid .
i have two radcombobox in a column template on a radgrid,
when a change the selected item in the firts radcombobox
the elements of the second radcombobox must be change.
I did it, but only works when the grid is in editmode,
but not when the grid created a new item , what can i do what's wrong in my code.
(i'am usig radcontrols 2008 q1,vs2005 and vb)
| Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated | |
| If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then | |
| Dim list As RadComboBox = CType(CType(e.Item, GridEditableItem)("TemplateColumn").Controls(1), RadComboBox) | |
| list.AutoPostBack = True | |
| AddHandler list.SelectedIndexChanged, AddressOf Me.list_SelectedIndexChanged | |
| End If | |
| End Sub | |
| Private Sub list_SelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) | |
| Dim editedItem As GridEditableItem = CType(CType(sender, RadComboBox).NamingContainer, GridEditableItem) | |
| Dim ddList As RadComboBox = CType(editedItem("NroCelular").Controls(1), RadComboBox) | |
| Dim sql As String = "SELECT [NroCelular] FROM [Celulares] WHERE idUsuario=@idUsuario ORDER BY [NroCelular] " | |
| Dim parameters As New Collection | |
| Dim parameter1 As New OleDbParameter | |
| parameter1.ParameterName = "@idUsuario" | |
| parameter1.OleDbType = OleDbType.Integer | |
| parameter1.Value = CType(editedItem("TemplateColumn").Controls(1), RadComboBox).SelectedValue | |
| parameters.Add(parameter1) | |
| ddList.Items.Clear() | |
| Dim table As DataTable = dbManager.getDataTable(sql, parameters) | |
| Dim row As DataRow | |
| For Each row In table.Rows | |
| Dim item As New RadComboBoxItem(row(0), row(0)) | |
| ddList.Items.Add(item) | |
| Next | |
| End Sub | |
| Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound | |
| If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then | |
| Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) | |
| Dim editMan As GridEditManager = editedItem.EditManager | |
| Dim editor As GridTemplateColumnEditor = CType(editMan.GetColumnEditor("NroCelular"), GridTemplateColumnEditor) | |
| Dim ddlOrderIDcombo As RadComboBox = CType(editedItem("TemplateColumn").Controls(1), RadComboBox) | |
| Dim sql As String = "SELECT [NroCelular] FROM [Celulares] WHERE idUsuario=@idUsuario ORDER BY [NroCelular] " | |
| Dim parameters As New Collection | |
| Dim parameter1 As New OleDbParameter | |
| parameter1.ParameterName = "@idUsuario" | |
| parameter1.OleDbType = OleDbType.Integer | |
| parameter1.Value = CType(editedItem("TemplateColumn").Controls(1), RadComboBox).SelectedValue | |
| parameters.Add(parameter1) | |
| Dim table As DataTable = dbManager.getDataTable(sql, parameters) | |
| Dim ddList As RadComboBox = CType(editedItem("NroCelular").Controls(1), RadComboBox) | |
| ddList.DataSource = table | |
| ddList.Items.Clear() | |
| Dim row As DataRow | |
| For Each row In table.Rows | |
| Dim item As New RadComboBoxItem(row(0), row(0)) | |
| ddList.Items.Add(item) | |
| Next | |
| End If | |
| End Sub |
| <telerik:GridTemplateColumn DataField="NombreCompleto" FilterImageToolTip="Filtrar" | |
| HeaderText="Usuario" SortExpression="NombreCompleto" UniqueName="TemplateColumn"> | |
| <ItemTemplate> | |
| <asp:Label ID="Label3" runat="server" Text='<%# Eval("NombreCompleto") %>'></asp:Label> | |
| </ItemTemplate> | |
| <EditItemTemplate> | |
| <telerik:RadComboBox ID="cmbUsuario" runat="server" DataSourceID="dsUsuarios" DataTextField="NombreCompleto" | |
| DataValueField="idUsuario" | |
| SelectedValue='<%# Bind("idUsuario") %>' Skin="WebBlue" Width="200px" > | |
| <CollapseAnimation Duration="200" Type="OutQuint" /> | |
| </telerik:RadComboBox> | |
| </EditItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridTemplateColumn DataField="NroCelular" FilterImageToolTip="Filtrar" HeaderText="Nro Celular" | |
| SortExpression="NroCelular" UniqueName="NroCelular"> | |
| <ItemTemplate> | |
| <asp:Label ID="Label2" runat="server" Text='<%# Eval("NroCelular") %>'></asp:Label> | |
| </ItemTemplate> | |
| <EditItemTemplate> | |
| <telerik:RadComboBox ID="cmbNroCelular" runat="server" Skin="WebBlue" Width="200px" > | |
| <CollapseAnimation Duration="200" Type="OutQuint" /> | |
| </telerik:RadComboBox> | |
| </EditItemTemplate> | |
| </telerik:GridTemplateColumn> |
this is my code from the client side
