Hi,
I'm using Dual ListBox with the source and destination are databound to their respective datatables. After transfer to the right, the datatable is not updating and remains empty. I've tried both RadAjaxPanel and ASP UpdatePanel, the result is the same.
Telerik Version:
2014.1.403.45
ASPX:
001.<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>002.<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>003.<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>004.<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>005.<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>006.<%@ Import Namespace="Microsoft.SharePoint" %>007.<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>008. 009.<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="PhoneBookPicker.aspx.vb" Inherits="XXXXXPortalAdditions.Layouts.XXXXXXPortalAdditions.Pages.PhoneBookPicker" DynamicMasterPageFile="~masterurl/default.master" %>010. 011.<%@ Register Assembly="Telerik.Web.UI, Version=2014.1.403.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>012. 013.<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">014.</asp:Content>015. 016.<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">017. 018. <!--This is where we hide the not needed default SharePoint elements and fix margins -->019. <script type="text/javascript">020. $(document).ready(function () {021. 022. $('#sideNavBox').css('display', 'none');023. $('#contentRow').css('padding-top', '0px');024. $('#contentBox').css({ 'margin-right': '0px', 'margin-left': '0px' })025. 026. });027. </script>028. 029. 030. 031. <input id="usrSearch" type="search" placeholder="חיפוש..." style="width: 154px; height: 25px; margin-bottom: 5px; margin-top: 2px; margin-right: 1px; background: url('/_layouts/15/images/XXXXXPortalAdditions/apps_search.png') no-repeat 6px 6px;" dir="rtl" />032. <div dir="ltr" style="margin-top: 40px; text-align: center;">033. 034. <%-- <telerik:RadFormDecorator ID="RadFormDecorator1" DecoratedControls="All" runat="server" />035. <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">--%>036. <asp:UpdateProgress ID="updProgress" AssociatedUpdatePanelID="UpdatePanelAddFavs" runat="server">037. <ProgressTemplate>038. <div class="animationload">039. <span>טוען...</span>040. <div class="preloader"></div>041. </div>042. </ProgressTemplate>043. </asp:UpdateProgress>044. <asp:UpdatePanel runat="server" ID="UpdatePanelAddFavs" UpdateMode="Conditional" Visible="True">045. <ContentTemplate>046. 047. <telerik:RadListBox ID="RadListBoxSource" runat="server" AllowTransfer="true" AllowAutomaticUpdates="True" AutoPostBackOnTransfer="true" AllowDelete="false" EnableDragAndDrop="true" SelectionMode="Multiple" ButtonSettings-ShowTransferAll="false" Localization-ToLeft="העבר חזרה לרשימה כללית" Localization-ToRight="העבר לקבוצת מועדפים שלי" Localization-MoveDown="הזז למטה" Localization-MoveUp="הזז למעלה" TransferToID="RadListBoxDestination" Height="400px" Width="300px"></telerik:RadListBox>048. 049. <telerik:RadListBox ID="RadListBoxDestination" runat="server" AllowReorder="true" AllowAutomaticUpdates="True" AutoPostBackOnTransfer="true" EnableDragAndDrop="true" AllowDelete="false" SelectionMode="Multiple" Height="400px" Width="300px"></telerik:RadListBox>050. <div id="divButtons">051. <asp:Button ID="btnSubmitFav" runat="server" Text="שמור שינויים" Height="40px" Width="80px" OnClick="btnSubmitFav_Click" />052. </div>053. <div id="divError" runat="server"></div>054. <%-- </telerik:RadAjaxPanel>--%>055. 056. </ContentTemplate>057. </asp:UpdatePanel>058. </div>059. 060. 061. <!--This is where we filter the Listbox left side for XXXXX employees via keystrokes -->062. <!--I take the already existing class that the control adds to all the items and I work with it - class ".rlbItem" -->063. <script type="text/javascript">064. $(document).ready(065. function () {066. var $users = $('.rlbItem');067. $('#usrSearch').keyup(function () {068. if ($.trim($(this).val()) == "") {069. $users.show();070. return;071. }072. var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();073. 074. $users.show().filter(function () {075. var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();076. return !~text.indexOf(val);077. }).hide();078. });079. 080. 081. }082. );083. </script>084. <!--This is where we prevent default Enter key functionality -->085. <script type="text/javascript">086. $(document).ready(function () {087. $('.prvntEnterKey').bind('keypress', function (e) {088. if (e.keyCode == 13) {089. e.preventDefault();090. 091. }092. });093. });094. </script>095.</asp:Content>096. 097.<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">098.</asp:Content>099. 100.<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">101.</asp:Content>
CodeBehind:
001.Imports System002.Imports Microsoft.SharePoint003.Imports Microsoft.SharePoint.WebControls004.Imports MyDal005.Imports System.Web.UI006.Imports Telerik.Web.UI007.Imports System.Text008.Imports System.Web.UI.WebControls009. 010.Namespace Layouts.MyPortalAdditions.Pages011. 012. Partial Public Class PhoneBookPicker013. Inherits LayoutsPageBase014. 015.#Region "Properties"016. 'Private Property SrcTable() As DataTable017. ' Get018. ' Return CType(ViewState("SrcTable"), DataTable)019. ' End Get020. ' Set(ByVal value As DataTable)021. ' ViewState("SrcTable") = value022. ' End Set023. 'End Property024. 025. 'Private Property DestTable() As DataTable026. ' Get027. ' Return CType(ViewState("DestTable"), DataTable)028. ' End Get029. ' Set(ByVal value As DataTable)030. ' ViewState("DestTable") = value031. ' End Set032. 'End Property033. 034. Private m_SrcTable As DataTable035. Public Property SrcTable() As DataTable036. Get037. Return m_SrcTable038. End Get039. Set(ByVal value As DataTable)040. m_SrcTable = value041. End Set042. End Property043. 044. Private m_DestTable As DataTable045. Public Property DestTable() As DataTable046. Get047. Return m_DestTable048. End Get049. Set(ByVal value As DataTable)050. m_DestTable = value051. End Set052. End Property053. 054. Private s_user As String055. Public Property sUser() As String056. Get057. Return s_user058. End Get059. Set(ByVal value As String)060. s_user = value061. End Set062. End Property063.#End Region064. 065.#Region "Initializations"066. 067. Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load068. 069. If Not Page.IsPostBack Then070. initUser()071. initSrcTable()072. initDestTable()073. initRadListBoxSource()074. initRadListBoxDestination()075. End If076. 077. End Sub078. 079. Private Sub initUser()080. Dim oWeb As SPWeb = SPContext.Current.Web081. sUser = MyUtilities.GetCurrentUserLoginName(oWeb)082. End Sub083. 084. Private Sub initSrcTable()085. Dim sMyDal As MyDal.SqlDal086. Dim connStr As String = ListsProvider.My_CONN_STR087. sMyDal = New SqlDal(connStr, True)088. Dim SPName As String = "PRS_MyData.dbo.USP_Get_EmployeePhone"089. Dim paramArr As SqlParams090. Try091. 092. paramArr = New SqlParams093. paramArr.Add(New SqlParam("@SearchName", SqlParam.ParamType.ptChar, SqlParam.ParamDirection.pdInput, ""))094. SrcTable = sMyDal.ExecuteSPReturnDT(SPName, paramArr)095. 096. Catch ex As Exception097. divError.Controls.Add(New LiteralControl("<div>Exception: " & ex.Message & "</div>"))098. Finally099. sMyDal = Nothing100. End Try101. 102. End Sub103. 104. Private Sub initDestTable()105. Dim sMyDal As MyDal.SqlDal106. Dim connStr As String = ListsProvider.My_CONN_STR107. sMyDal = New SqlDal(connStr, True)108. Dim SPName As String = "PRS_MyData.dbo.USP_PIE_GET_PERSONAL_LIST"109. Dim paramArr As SqlParams110. Try111. 112. paramArr = New SqlParams113. paramArr.Add(New SqlParam("@AD_USER", SqlParam.ParamType.ptChar, SqlParam.ParamDirection.pdInput, sUser))114. DestTable = sMyDal.ExecuteSPReturnDT(SPName, paramArr)115. DestTable.AcceptChanges()116. 117. Catch ex As Exception118. divError.Controls.Add(New LiteralControl("<div>Exception: " & ex.Message & "</div>"))119. Finally120. sMyDal = Nothing121. End Try122. End Sub123. 124. Private Sub initRadListBoxSource()125. RadListBoxSource.DataSource = SrcTable126. RadListBoxSource.DataTextField = "Emp Name"127. RadListBoxSource.DataKeyField = "Employeeno"128. RadListBoxSource.DataBind()129. End Sub130. 131. Private Sub initRadListBoxDestination()132. RadListBoxDestination.DataSource = DestTable133. RadListBoxDestination.DataTextField = "name"134. RadListBoxDestination.DataKeyField = "EMPNO"135. RadListBoxDestination.DataBind()136. End Sub137. 138.#End Region139. 140.#Region "DB Actions"141. 142. Private Sub deleteFavoritesFromDB()143. Dim dt As DataTable144. Dim sMyDal As MyDal.SqlDal145. Dim connStr As String = ListsProvider.My_CONN_STR146. sMyDal = New SqlDal(connStr, True)147. Dim sSqlSelect As String = "Select * from PRS_MyData.dbo.Pie_Personal_List where AD_USER = '" & sUser & "'"148. Dim sSqlDelete As String = "Delete from PRS_MyData.dbo.Pie_Personal_List where AD_USER = '" & sUser & "'"149. Try150. dt = sMyDal.GetDataTable(sSqlSelect)151. If dt.Rows.Count > 0 Then152. sMyDal.ExecuteSql(sSqlDelete)153. End If154. Catch ex As Exception155. divError.Controls.Add(New LiteralControl("<div>Exception: " & ex.Message & "</div>"))156. Finally157. sMyDal = Nothing158. dt = Nothing159. End Try160. End Sub161. 162. Private Sub writeFavoritesToDB()163. Dim row As DataRow164. Dim sMyDal As MyDal.SqlDal165. Dim connStr As String = ListsProvider.My_CONN_STR166. sMyDal = New SqlDal(connStr, True)167. Dim SPname As String = "PRS_MyData.dbo.USP_PIE_ADD_PERSONAL_LIST_ITEM"168. Dim paramArr As SqlParams169. 170. Try171. For Each row In DestTable.Rows172. paramArr = New SqlParams173. paramArr.Add(New SqlParam("@name", SqlParam.ParamType.ptChar, SqlParam.ParamDirection.pdInput, sUser))174. paramArr.Add(New SqlParam("@EMPNO", SqlParam.ParamType.ptChar, SqlParam.ParamDirection.pdInput, row("empno").ToString()))175. sMyDal.ExecuteSP(SPname, paramArr)176. Next177. 178. Catch ex As Exception179. divError.Controls.Add(New LiteralControl("<div>Exception: " & ex.Message & "</div>"))180. Finally181. sMyDal = Nothing182. End Try183. End Sub184. 185.#End Region186. 187.#Region "Events"188. 189. Protected Sub btnSubmitFav_Click(sender As Object, e As EventArgs)190. 191. deleteFavoritesFromDB()192. If RadListBoxDestination.Items.Count > 0 Then193. writeFavoritesToDB()194. End If195. 196. 197. End Sub198. 199.#End Region200. 201. 202. End Class203. 204.End NamespaceThanks in Advance!