Telerik RadListBox控件在启用AJAX的ASP.NET页面中单击其他按钮时触发事件

Telerik RadListBox控件在启用AJAX的ASP.NET页面中单击其他按钮时触发事件,asp.net,ajax,transfer,radlistbox,Asp.net,Ajax,Transfer,Radlistbox,RadListBox将项目从源传输到目标,即使在我单击页面中的按钮时,也会被触发。我怎样才能阻止它 重现问题的步骤–加载页面。点击按钮。请参见AJAX更新面板中列表框的项目计数。它将分别正确显示–7(源)和0(目标)。将一项从源移动到目标RadListBox。再次单击按钮–第一次显示6(源)和1(目标)。然后再次单击按钮–显示5(源)和2(目标)…然后单击按钮。。它显示4(源)和3(目标)。用户界面中没有任何变化 我相信,即使单击按钮,从源到目标的传输事件也会被触发。单击按钮时如何停止传输事件

RadListBox将项目从源传输到目标,即使在我单击页面中的按钮时,也会被触发。我怎样才能阻止它

重现问题的步骤–加载页面。点击按钮。请参见AJAX更新面板中列表框的项目计数。它将分别正确显示–7(源)和0(目标)。将一项从源移动到目标RadListBox。再次单击按钮–第一次显示6(源)和1(目标)。然后再次单击按钮–显示5(源)和2(目标)…然后单击按钮。。它显示4(源)和3(目标)。用户界面中没有任何变化

我相信,即使单击按钮,从源到目标的传输事件也会被触发。单击按钮时如何停止传输事件

在我的页面中,我必须刷新AJAX更新面板,但我不希望同时更改RadListBox中的项目

ASPX页-

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestRadListBox.WebForm1" %>

<%@ 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">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head runat="server">
     <title></title>
 </head>
 <body>
     <form id="form1" runat="server">
     <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
     </telerik:RadScriptManager>
     <div>
         <table>
             <tr>
                 <th colspan="2">Move 1 Item from Left to Right and then click the button below and see the Item Counts</th>
             </tr>
             <tr>
                 <td>
                     <telerik:RadListBox ID="SourceRadListBox" runat="server" Height="100px" Width="200px"
                         AllowTransfer="true" TransferToID="TargetRadListBox">
                     </telerik:RadListBox>
                 </td>
                 <td>
                     <telerik:RadListBox runat="server" ID="TargetRadListBox" Height="100px" Width="175px"
                         AllowReorder="true" />
                 </td>
             </tr>
         </table>
     </div>
     <br/>
     <div>
         Time OUTSIDE Update Panel : <asp:Label ID="timeOutsideLabel" runat="server"/>
     </div>
     <br/>
     <div align="left">
         <asp:Button ID="addRuleButton" runat="server" Text="Click To Refresh The Time Below Inside AJAX Update Panel" 
            onclick="addRuleButton_Click" />
     </div>
     <br/>
     <div>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
             <ContentTemplate>
             <table border = "2">
                 <tr><th>AJAX Update Panel</th></tr>
                 <tr><td>Time INSIDE Update Panel : <asp:Label ID="timeInsideLabel" runat="server"/></td></tr>
                 <tr><td>Item Count in Source RadListBox : <asp:Label ID="srcCount" runat="server"/></td></tr>
                 <tr><td>Item Count in Target RadListBox : <asp:Label ID="tarCount" runat="server"/></td></tr>
             </table>
             </ContentTemplate>
             <Triggers>
                 <asp:AsyncPostBackTrigger ControlID="addRuleButton" EventName="Click" />
             </Triggers>
         </asp:UpdatePanel>
     </div>
     </form>
 </body>
 </html>

从左向右移动1个项目,然后单击下面的按钮,查看项目计数

更新面板外的时间:

AJAX更新面板 更新面板内的时间: 源列表框中的项目计数: 目标列表框中的项目计数:
C#代码隐藏-

 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;

namespace TestRadListBox
 {
     public partial class WebForm1 : System.Web.UI.Page
     {
         protected void Page_Load(object sender, EventArgs e)
         {
             if (!IsPostBack)
             {
                 List<string> week = new List<string> { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
                 SourceRadListBox.DataSource = week;
                 SourceRadListBox.DataBind();
                 string timenow = DateTime.Now.ToLongTimeString();
                 timeInsideLabel.Text = timenow;
                 timeOutsideLabel.Text = timenow;
             }
         }

        protected void addRuleButton_Click(object sender, EventArgs e)
         {
             timeInsideLabel.Text = DateTime.Now.ToLongTimeString();
             srcCount.Text = SourceRadListBox.Items.Count.ToString();
             tarCount.Text = TargetRadListBox.Items.Count.ToString();
         }
     }
 }
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;
使用System.Web.UI;
使用System.Web.UI.WebControl;
使用Telerik.Web.UI;
命名空间TestRadListBox
{
公共部分类WebForm1:System.Web.UI.Page
{
受保护的无效页面加载(对象发送方、事件参数e)
{
如果(!IsPostBack)
{
名单周=新名单{“星期日”、“星期一”、“星期二”、“星期三”、“星期四”、“星期五”、“星期六”};
SourceRadListBox.DataSource=周;
SourceRadListBox.DataBind();
string timenow=DateTime.Now.ToLongTimeString();
timeInsideLabel.Text=timenow;
timeOutsideLabel.Text=timenow;
}
}
受保护的void addRuleButton\u单击(对象发送者,事件参数e)
{
timeInsideLabel.Text=DateTime.Now.ToLongTimeString();
srcCount.Text=SourceRadListBox.Items.Count.ToString();
tarCount.Text=TargetRadListBox.Items.Count.ToString();
}
}
}

如果回发中不包括列表框,则无法对带有列表框的页面进行部分回发: