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

RadListBox with Ajax doesn't update on buttonclick

1 Answer 103 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
sulejman Vezi
Top achievements
Rank 1
sulejman Vezi asked on 16 Jul 2013, 02:00 PM
Hey Guys.
I'm having a silly problem with updating the radlistbox on buttonclick.

can you give me a hint.

Thnx in advance

------.aspx------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="prova.aspx.cs" Inherits="Pages_prova" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager runat="server" ID="scriptMgr1">
        </asp:ScriptManager>
        <table>
            <tr>
                    <td align="left">
                        <telerik:RadListBox runat="server" ID="RL_PagesSource" Height="180px" Width="200px" ></telerik:RadListBox>
                    </td>
                    <td valign="top" align="center">
                    <br />
                        <telerik:RadButton ID="RB_PLeft" runat="server" Text=" > " Width="40px"
                            onclick="RB_PLeft_Click" SplitButtonCssClass=""
                            SplitButtonPosition="Right" ></telerik:RadButton><br /><br />
                        <telerik:RadButton ID="RB_PRight" runat="server" Text=" < " Width="40px"
                            SplitButtonCssClass="" SplitButtonPosition="Right" ></telerik:RadButton><br /><br />
                        <telerik:RadButton ID="RB_PLAll" runat="server" Text=" >> " Width="40" ></telerik:RadButton><br /><br />
                        <telerik:RadButton ID="RB_PRAll" runat="server" Text=" << " Width="40" ></telerik:RadButton><br /><br />
                    </td>
                    <td style="padding-left:30px;" align="left">
                        <telerik:RadListBox runat="server" ID="RL_PageDestination" Height="180" Width="200"
                AutoPostBack="True" onselectedindexchanged="RL_PageDestination_SelectedIndexChanged"></telerik:RadListBox>
                    </td>
            </tr>
        </table>
    </div>
     
    <telerik:RadAjaxManager runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RB_PLeft">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RL_PagesSource" />
                    <telerik:AjaxUpdatedControl ControlID="RL_PageDestination" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
    </form>
</body>
</html>


-----.aspx.cs----
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class Pages_prova : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            RL_PagesSource.Items.Add(new RadListBoxItem("aaaa", "asdf"));
            RL_PagesSource.Items.Add(new RadListBoxItem("aasdf", "asdf"));
            RL_PageDestination.Items.Add(new RadListBoxItem("aasasdfadf", "asdf"));
        }
    }
    protected void RB_PLeft_Click(object sender, EventArgs e)
    {
        if (RL_PagesSource.Items.Count == 0 || RL_PagesSource.SelectedItem == null)
        {
        }
        else
        {
            RadListBoxItem it = new RadListBoxItem();
            it = RL_PagesSource.SelectedItem;
            RL_PageDestination.Items.Add(new RadListBoxItem(it.Text, it.Value));
             RL_PageDestination.DataBind();
            // RL_PagesSource.SelectedItem.Remove();
            // RL_PagesSource.DataBind();
        }
    }
    protected void RL_PageDestination_SelectedIndexChanged(object sender, EventArgs e)
    {
 
    }
}

1 Answer, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 19 Jul 2013, 08:16 AM
Hello,

Could you elaborate a bit on the exact issue - what is the desired behavior, and how does it differ from the current behavior. Also, could you look at the following demo which demonstrates the Built-in transfer functionality in RadListBox:
http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/transfer/defaultcs.aspx

 

Regards,
Bozhidar
Telerik
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 the blog feed now.
Tags
ListBox
Asked by
sulejman Vezi
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Share this question
or