Hello,
I am working on a project with a RadListBox.
In the RadListBox there is a list of items.
Each item consists of 2 elements: text and a toggle RadButton.
The user can change the location of an item inside the list, by drag-and-drop and also can change the toggle-state of the RadButton.
I am trying to get the new order of the list, after such a change.
I get the new order of the texts, but not the order of the buttons. [View video]
How can I get also the new order of the buttons?
Thanks,
Daniel.
My code:
ASPX:
VB.NET:
I am working on a project with a RadListBox.
In the RadListBox there is a list of items.
Each item consists of 2 elements: text and a toggle RadButton.
The user can change the location of an item inside the list, by drag-and-drop and also can change the toggle-state of the RadButton.
I am trying to get the new order of the list, after such a change.
I get the new order of the texts, but not the order of the buttons. [View video]
How can I get also the new order of the buttons?
Thanks,
Daniel.
My code:
ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelCssClass="" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="Button1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="lbl_listSelected" /> <telerik:AjaxUpdatedControl ControlID="RadListBox1" UpdatePanelCssClass="" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="btn_up"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadListBox1" UpdatePanelCssClass="" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <table cellpadding="0" cellspacing="0" class="nav-justified"> <tr> <td class="auto-style1"> <telerik:RadListBox ID="RadListBox1" runat="server" AutoPostBackOnReorder="false" EnableDragAndDrop="true" AllowReorder="true" Skin="Metro" > <ButtonSettings ShowReorder="false"></ButtonSettings> <ItemTemplate> <telerik:RadButton ToggleType="CustomToggle" runat="server" AutoPostBack="false" Skin="Metro" ID="btn_Order" Width="26px" Height="18px" Checked="true" ButtonType="ToggleButton" OnClick="btn_Order_Click" EnableViewState="true"> <ToggleStates> <telerik:RadButtonToggleState ImageUrl="img/no-sort.png" Selected="true" IsBackgroundImage="true" Value="NoSort"/> <telerik:RadButtonToggleState ImageUrl="img/up.png" IsBackgroundImage="true" Value="Asc" /> <telerik:RadButtonToggleState ImageUrl="img/down.png" IsBackgroundImage="true" Value="Dsc"/> </ToggleStates> </telerik:RadButton> <span runat="server" id="Buttons_Name"><%# Eval("Col")%></span> <br /> </ItemTemplate> </telerik:RadListBox> </td> <td> <asp:Label ID="lbl_listSelected" runat="server" Text="Label"></asp:Label> </td> </tr> <tr> <td class="auto-style1"> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:Button ID="btn_up" runat="server" Text="up" /> </td> <td> </td> </tr> </table>VB.NET:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then columnsTable = generateListCol() RadListBox1.DataSource = columnsTable RadListBox1.DataTextField = "Col" RadListBox1.DataBind() End If End Sub Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim sb As New StringBuilder Dim collection As IList(Of RadListBoxItem) = RadListBox1.Items For Each item As RadListBoxItem In collection Dim btn As RadButton = CType(item.FindControl("btn_Order"), RadButton) sb.Append(item.Text + " - " + btn.SelectedToggleState.Value + "<br />") Next lbl_listSelected.Text = sb.ToString End Sub