Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
142 views
Hi.

My existing dataform was pulling through the data fields just fine, but I needed to separate them into category’s so decided to use the RadPanelBar.
But now the fields with in the RadPanelBar wont display.
It seems silly that you have to rebind this data all over again when the dataform has it already, is there a way to pass through the dataform data into RadPanelBar. After all its sitting in its itemtemplate!

Many Thanks

Mark

<itemtemplate>
 
        <div class="rdfRow">
            <asp:Label ID="p_codeLabel2" runat="server" CssClass="rdfLabel" Text="p_code"></asp:Label>
            <asp:Label ID="p_codeLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("p_code") %>' />
        </div>
        <div class="rdfRow">
            <asp:Label ID="p_nameLabel2" runat="server" CssClass="rdfLabel" Text="p_name"></asp:Label>
            <asp:Label ID="p_nameLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("p_name") %>' />
        </div>
 
        <telerik:RadPanelBar RenderMode="Lightweight" runat="server" ID="RadPanelBar2" Width="90%" ExpandMode="MultipleExpandedItems" >
            <Items>
                <telerik:RadPanelItem Expanded="True" Text="Product key Information">
                    <ContentTemplate>
                        <div class="rdfRow">
                            <asp:Label ID="p_descriptionLabel2" runat="server" CssClass="rdfLabel" Text="p_description"></asp:Label>
                            <asp:Label ID="p_descriptionLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("p_description") %>' />
                        </div>
 
                        <div class="rdfRow">
                            <asp:Label ID="p_dateLabel2" runat="server" CssClass="rdfLabel" Text="p_date"></asp:Label>
                            <asp:Label ID="p_dateLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("p_date") %>' />
                        </div>
 
 
                  </ContentTemplate>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>
</itemtemplate>
Viktor Tachev
Telerik team
 answered on 01 Jul 2016
1 answer
347 views

Hi,

I am trying to use the plugin footable on GridView but it does not work. Maybe you would have an idea about my problem?

Here is the code of my ascx file:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Search.ascx.cs" Inherits="Controls.Search.Search" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>

<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/css/footable.min.css"
    rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/js/footable.min.js"></script>
<script type="text/javascript">
    $(function () {
        alert("enter function footable");
        $('[id*=GridView1]').bind('footable_breakpoint', function () {
            $('[id*=GridView1]').trigger('footable_expand_first_row');
        }).footable();
        alert("exit function footable");
    });
</script>
<div>
  <asp:GridView ID="GridView1" CssClass="footable" runat="server"
           AutoGenerateColumns="False">
       <Columns>
           <asp:BoundField DataField="FirstName" HeaderText="First Name"   />
           <asp:BoundField DataField="LastName" HeaderText="Last Name" />
           <asp:BoundField DataField="Email" HeaderText="Email" />
           <asp:BoundField DataField="Contact" HeaderText="Contact" />
       </Columns>
   </asp:GridView>
</div>

Here the cs file that define the grid:

DataTable tab = new DataTable();
            tab.Columns.Add("FIRSTNAME", typeof(string));
            tab.Columns.Add("LASTNAME", typeof(string));
            tab.Columns.Add("EMAIL", typeof(string));
            tab.Columns.Add("CONTACT", typeof(string));
            
            var firstname = "toto";
            var lastname = "toto";
            var email = "toto@email";
            var contact = "loremipsum loremipsum loremipsumloremipsum";
            tab.Rows.Add(new object[] { firstname, lastname, email, contact });

            GridView1.DataSource = tab;
            GridView1.DataBind();

            //Attribute to show the Plus Minus Button
            GridView1.HeaderRow.Cells[0].Attributes["data-class"] = "expand";

            //Attribute to hide column in Phone and Tablet
            GridView1.HeaderRow.Cells[0].Attributes["data-hide"] = "phone,tablet";
            GridView1.HeaderRow.Cells[0].Attributes["data-hide"] = "phone,tablet";

            //Adds THEAD and TBODY to GridView
            GridView1.UseAccessibleHeader = true;
            GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;

The 2 alerts in the javascript are displayed but the table remains unchanged when I resize the window to phone size....

Kostadin
Telerik team
 answered on 01 Jul 2016
7 answers
902 views
In the past I have used something like this:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

        {

            if (e.Row.RowType == DataControlRowType.DataRow)

            {

                var dr = (ObjectTypeBeingBound)e.Row.DataItem;

                HyperLink editLink = (HyperLink)e.Row.FindControl("hlEditLink");

                editLink.Attributes.Add("onclick", String.Format("openRadWindow({0},{1})", dr.Id, dr.Name));

            }

        }

How do I do similar with a RadGrid?  My best attempt (not an exact replacement for the above method) so far is:

protected void gvSpecs_ItemDataBound(object sender, GridItemEventArgs e)

        {

            if (e.Item is GridDataItem)

            {

                GridDataItem item = (GridDataItem)e.Item;

                var supplierPartNumber = item.GetDataKeyValue("SupplierPartNumber");

                var setNo = item.GetDataKeyValue("SetNo");

                HyperLink editLink = (HyperLink)item["editAttributes"].Controls[0];

                editLink.Attributes.Add("onclick", String.Format("openRadWindow({0},{1})"

                    supplierPartNumber != null ? supplierPartNumber: String.Empty, 

                    setNo != null ? setNo : String.Empty));                

            }

        }


But I can seem to only access the datakeys and not the rest of the datasource cast as an object.

Thanks
Eyup
Telerik team
 answered on 01 Jul 2016
5 answers
102 views

I have project test schedule (using version 2016.2.504.40). This sourcecode and script Db in attachment.

When I compare data view MonthView default and WeekView default diffrent data.

1. Page1 set SelectedView="MonthView", data show in Date (27-Jun + 28-Jun + 30-Jun). See image: MonthView_Default.JPG (in attachment)

2. Page2 set SelectedView="WeekView", click next week onview, data show in date (28-Jun), but not show in date (27-Jun + 30-Jun). See image: WeekView_Default.JPG (in attachment) 

Why???

The codeBehide the same in two page. only set SelectedView of two page.

How to fix this issue???

Link myWebtest online: http://115.146.121.171:8085/

Nencho
Telerik team
 answered on 01 Jul 2016
2 answers
71 views

Hi, I have two grids with ajax and one function that opens a window with a windowmanager, when using the function in the first grid (with a button and in the updatecommand) it works ok and it shows a message I put with the current time, but If I try to use that function from an event in the second grid it shows the last message not current. I'll try to explain:

 

- the new window has a label when I put the next message: current time + "bla bla" before opening it

- if I use it from the first grid it shows the current time but from the second grid it shows the last message not the current time...

luis molina
Top achievements
Rank 1
 answered on 30 Jun 2016
5 answers
293 views

Hi,

I'm using a FilterCheckList and it works on a simple RadGrid (Capture1.jpg). But when I add detail using GridTableView send me an error (Capture2.jpg).

Someone could send me an example using  FilterCheckList and GridTableView?

Regards.

Rocío Ojeda.

 

Pavlina
Telerik team
 answered on 30 Jun 2016
3 answers
233 views

Hello

See attached mockups.

I am trying to produce a line chart with 6 lines on it - 3 lines that represent regional, domestic and international sales in year 2015 and 3 more lines that represent the same reg/dom/int sales data but in 2016 (basically a year over year chart where the x-axis shows the month names and each set of 3 line series represents the international, domestic and regional sales data in that particular year).

The customer has requested that when showing the 3 line series for the 2015 sales data that the lines are within the same color but different shades so it is easy to see all 3 are within 2015. For example if all 2015 lines were blue-like, then I need to dynamically change the line series 1 = LightBlue, line series 2 = Blue and line series 3 = NavyBlue (light, regular, dark colored basically). The same idea for the 2016 lines, they should all be red-like for example Burgundy, Red, Pink.

The challenge I have is that we are utilizing Telerik skins so the customer could have any telerik skin applied to the website (Silk Skin, Glow, MetroTouch, whatever). I want to be able to pick color that make sense with the Skin selected and shade them vs. hard coding it to shades of blue or red since this will not look right depending on the Skin applied.

 

My design thinking was as follows:

-Derive the Skin being used from the RadSkinManager

-Somehow determine the color palette used by that skin - not sure how to do this?

-Pick 2 colors in that color palette that are "far apart" (2 colors that look the least like each other), shade them and set the LineSeries.Appearance.FillStyle.BackgroundColor on each set of 3 line series.

 

I've found all the code I need to make that design work but I cannot derive how to get the base color palette of a given skin.

 

Vessy
Telerik team
 answered on 30 Jun 2016
3 answers
193 views

Good morning,

 

I've got a GridTemplateColumn that has a set width (10%) and that implements both an Item- and EditItemTemplate. These templates implement asp:table(s) with colspan. The colspan of the itemtemplate is set to 2 and implements two rows, one with a label and one with two buttons.

My problem is that the buttons look slightly too big in relations to the label (see attached screendump).

 

 

I've attempted to setting the width / height in the buttons, but to no effect.

In addition to that I've attempted to set the w/h in CSS, both with a reference to the css-class through the control(s), but also through attempting to set all controls of type RadPushButton.

Still, nothing...

 

Any help would be appriciated!

 

This is the code for the GridTemplateColumn in question:

<telerik:GridTemplateColumn HeaderText="Actual Finish" AllowFiltering="False" runat="server" HeaderStyle-Width="10%" UniqueName="ActualFinish">
            <ItemTemplate>
                <table>
                    <tr>
                        <td colspan="2">
                            <telerik:RadLabel ID="RlblActualFinish" runat="server" Text='<%# Bind ("ActualFinish") %>'       UniqueName="RlblActualFinish"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1">
                            <telerik:RadPushButton runat="server" ID="RpbActualFinish" Text="Now" CommandName="FinishNow" RenderMode="Auto" cssclass="radpushbutton"/>
                        </td>
 
                        <td colspan="1">
                            <telerik:RadPushButton runat="server" ID="RbtnActualPlannedFinish" Text="Planned" CommandName="FinishPlanned" RenderMode="Auto" />
                        </td>
                    </tr>
                </table>
                                                     
            </ItemTemplate>
 
            <EditItemTemplate>
                <table>
                    <tr>
                            <td colspan="12">
                        <uc2:ctrlDatetimeActivity id="ctrlActualFinishColumn" runat="server"
                            SelectedDateTime='<%# If(Eval("ActualFinish") Is DBNull.Value, Datetime.now(), Eval("ActualFinish"))%>' />
 
                            </td>
                    </tr>
                    <tr>
                            <td colspan="1">
                            <telerik:RadPushButton runat="server" ID="RbtnFinishNowIP" Text="Now" CommandName="FinishNowIP" RenderMode="Auto" />
                            </td>
                                                               
                            <td colspan="1">
                            <telerik:RadPushButton runat="server" ID="RbtnFinishPlannedIP" Text="Planned" CommandName="FinishPlannedIP" RenderMode="Auto" />
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                            <td colspan="1">
                            </td>
                    </tr>
                                                     
                </table>
 
            </EditItemTemplate>
 
</telerik:GridTemplateColumn>

 

Pavlina
Telerik team
 answered on 30 Jun 2016
1 answer
131 views

I have a combo with Autopostback = false. When I click on the small arrow to pull the contents down, its triggers a postback, but if I click the text area, its does NOT cause a post back (which is what i want).   This ONLY happens then RenderMode="Lightweight" 

The combo is in the <EditItemTemplate> of a radgrid,

 <telerik:GridTemplateColumn HeaderText="Days" ItemStyle-Width="240px"  >

                            <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "Status")%>
                            </ItemTemplate>
                        
                            <EditItemTemplate>
                            <telerik:RadComboBox RenderMode="Lightweight" runat="server" ID="RadComboBox1" DataTextField="Day" 
                                DataValueField="DayID" OnDataBound="RadComboBox1_DataBound"  >
                            </telerik:RadComboBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>

Peter Milchev
Telerik team
 answered on 30 Jun 2016
2 answers
163 views

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 System
002.Imports Microsoft.SharePoint
003.Imports Microsoft.SharePoint.WebControls
004.Imports MyDal
005.Imports System.Web.UI
006.Imports Telerik.Web.UI
007.Imports System.Text
008.Imports System.Web.UI.WebControls
009. 
010.Namespace Layouts.MyPortalAdditions.Pages
011. 
012.    Partial Public Class PhoneBookPicker
013.        Inherits LayoutsPageBase
014. 
015.#Region "Properties"
016.        'Private Property SrcTable() As DataTable
017.        '    Get
018.        '        Return CType(ViewState("SrcTable"), DataTable)
019.        '    End Get
020.        '    Set(ByVal value As DataTable)
021.        '        ViewState("SrcTable") = value
022.        '    End Set
023.        'End Property
024. 
025.        'Private Property DestTable() As DataTable
026.        '    Get
027.        '        Return CType(ViewState("DestTable"), DataTable)
028.        '    End Get
029.        '    Set(ByVal value As DataTable)
030.        '        ViewState("DestTable") = value
031.        '    End Set
032.        'End Property
033. 
034.        Private m_SrcTable As DataTable
035.        Public Property SrcTable() As DataTable
036.            Get
037.                Return m_SrcTable
038.            End Get
039.            Set(ByVal value As DataTable)
040.                m_SrcTable = value
041.            End Set
042.        End Property
043. 
044.        Private m_DestTable As DataTable
045.        Public Property DestTable() As DataTable
046.            Get
047.                Return m_DestTable
048.            End Get
049.            Set(ByVal value As DataTable)
050.                m_DestTable = value
051.            End Set
052.        End Property
053. 
054.        Private s_user As String
055.        Public Property sUser() As String
056.            Get
057.                Return s_user
058.            End Get
059.            Set(ByVal value As String)
060.                s_user = value
061.            End Set
062.        End Property
063.#End Region
064. 
065.#Region "Initializations"
066. 
067.        Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
068. 
069.            If Not Page.IsPostBack Then
070.                initUser()
071.                initSrcTable()
072.                initDestTable()
073.                initRadListBoxSource()
074.                initRadListBoxDestination()
075.            End If
076. 
077.        End Sub
078. 
079.        Private Sub initUser()
080.            Dim oWeb As SPWeb = SPContext.Current.Web
081.            sUser = MyUtilities.GetCurrentUserLoginName(oWeb)
082.        End Sub
083. 
084.        Private Sub initSrcTable()
085.            Dim sMyDal As MyDal.SqlDal
086.            Dim connStr As String = ListsProvider.My_CONN_STR
087.            sMyDal = New SqlDal(connStr, True)
088.            Dim SPName As String = "PRS_MyData.dbo.USP_Get_EmployeePhone"
089.            Dim paramArr As SqlParams
090.            Try
091. 
092.                paramArr = New SqlParams
093.                paramArr.Add(New SqlParam("@SearchName", SqlParam.ParamType.ptChar, SqlParam.ParamDirection.pdInput, ""))
094.                SrcTable = sMyDal.ExecuteSPReturnDT(SPName, paramArr)
095. 
096.            Catch ex As Exception
097.                divError.Controls.Add(New LiteralControl("<div>Exception: " & ex.Message & "</div>"))
098.            Finally
099.                sMyDal = Nothing
100.            End Try
101. 
102.        End Sub
103. 
104.        Private Sub initDestTable()
105.            Dim sMyDal As MyDal.SqlDal
106.            Dim connStr As String = ListsProvider.My_CONN_STR
107.            sMyDal = New SqlDal(connStr, True)
108.            Dim SPName As String = "PRS_MyData.dbo.USP_PIE_GET_PERSONAL_LIST"
109.            Dim paramArr As SqlParams
110.            Try
111. 
112.                paramArr = New SqlParams
113.                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 Exception
118.                divError.Controls.Add(New LiteralControl("<div>Exception: " & ex.Message & "</div>"))
119.            Finally
120.                sMyDal = Nothing
121.            End Try
122.        End Sub
123. 
124.        Private Sub initRadListBoxSource()
125.            RadListBoxSource.DataSource = SrcTable
126.            RadListBoxSource.DataTextField = "Emp Name"
127.            RadListBoxSource.DataKeyField = "Employeeno"
128.            RadListBoxSource.DataBind()
129.        End Sub
130. 
131.        Private Sub initRadListBoxDestination()
132.            RadListBoxDestination.DataSource = DestTable
133.            RadListBoxDestination.DataTextField = "name"
134.            RadListBoxDestination.DataKeyField = "EMPNO"
135.            RadListBoxDestination.DataBind()
136.        End Sub
137. 
138.#End Region
139. 
140.#Region "DB Actions"
141. 
142.        Private Sub deleteFavoritesFromDB()
143.            Dim dt As DataTable
144.            Dim sMyDal As MyDal.SqlDal
145.            Dim connStr As String = ListsProvider.My_CONN_STR
146.            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.            Try
150.                dt = sMyDal.GetDataTable(sSqlSelect)
151.                If dt.Rows.Count > 0 Then
152.                    sMyDal.ExecuteSql(sSqlDelete)
153.                End If
154.            Catch ex As Exception
155.                divError.Controls.Add(New LiteralControl("<div>Exception: " & ex.Message & "</div>"))
156.            Finally
157.                sMyDal = Nothing
158.                dt = Nothing
159.            End Try
160.        End Sub
161. 
162.        Private Sub writeFavoritesToDB()
163.            Dim row As DataRow
164.            Dim sMyDal As MyDal.SqlDal
165.            Dim connStr As String = ListsProvider.My_CONN_STR
166.            sMyDal = New SqlDal(connStr, True)
167.            Dim SPname As String = "PRS_MyData.dbo.USP_PIE_ADD_PERSONAL_LIST_ITEM"
168.            Dim paramArr As SqlParams
169. 
170.            Try
171.                For Each row In DestTable.Rows
172.                    paramArr = New SqlParams
173.                    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.                Next
177. 
178.            Catch ex As Exception
179.                divError.Controls.Add(New LiteralControl("<div>Exception: " & ex.Message & "</div>"))
180.            Finally
181.                sMyDal = Nothing
182.            End Try
183.        End Sub
184. 
185.#End Region
186. 
187.#Region "Events"
188. 
189.        Protected Sub btnSubmitFav_Click(sender As Object, e As EventArgs)
190. 
191.            deleteFavoritesFromDB()
192.            If RadListBoxDestination.Items.Count > 0 Then
193.                writeFavoritesToDB()
194.            End If
195. 
196. 
197.        End Sub
198. 
199.#End Region
200. 
201. 
202.    End Class
203. 
204.End Namespace

Thanks in Advance!

Revital
Top achievements
Rank 1
 answered on 30 Jun 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?