Telerik Forums
UI for ASP.NET AJAX Forum
10 answers
342 views
After some action (ComboBoxSelectedItemChange) it throws the Console Error: Source and destination listbox can't be the same.

 I try to fix and understand the problem, but I can't. Please, help as fast as possible!
 
Here is my used telerik components and their properties:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID="RadListBoxADGroups">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadListBoxGroups" />
                   <telerik:AjaxUpdatedControl ControlID="LabelMessage" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="RadListBoxGroups">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="LabelMessage" />
               </UpdatedControls>
           </telerik:AjaxSetting>
           <telerik:AjaxSetting AjaxControlID="RadComboBoxPolice">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadListBoxGroups" />
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
  </telerik:RadAjaxManager>
          <table>
          <tr>
              <td>
                 <telerik:RadListBox ID="RadListBoxADGroups" runat="server" AllowTransfer="True" DataSourceID="ObjectDataSourceADGroup"
                      DataTextField="Name" Height="300px" Width="300px" TransferToID="RadListBoxGroups"
                      EmptyMessage="Active Directory is missing" AutoPostBackOnTransfer="True" OnTransferred="RadListBoxADGroupsTransferred"
                      EnableDragAndDrop="True" TransferMode="Copy">
                      <ButtonSettings TransferButtons="TransferFrom" Position="Right" VerticalAlign="Top"
                          AreaWidth="40" />
                  </telerik:RadListBox>
                  <asp:ObjectDataSource ID="ObjectDataSourceADGroup" runat="server" SelectMethod="SelectADGroups"
                      TypeName="Scheduler.WebClient.ADGroup"></asp:ObjectDataSource>
              </td>
              <td>
               <telerik:RadListBox ID="RadListBoxGroups" runat="server" EmptyMessage="No Sorted Groups"
                      Style="top: 0px; left: 0px; width: 250px; height: 300px" Height="300px" AutoPostBackOnDelete="True"
                      DataKeyField="GroupPoliceId" DataSourceID="ObjectDataSourceFiltGroups" DataTextField="Name"
                      DataValueField="Id" OnDeleted="RadListBoxGroupsDeleted" AllowDelete="True" OnClientDeleting="RadListBoxGroups_Deleting">
                      <ButtonSettings Position="Right" VerticalAlign="Top" AreaWidth="40" />
                  </telerik:RadListBox>
                  <asp:ObjectDataSource ID="ObjectDataSourceFiltGroups" runat="server" SelectMethod="SelectFilteredGroups"
                      TypeName="Scheduler.WebClient.Controller">
                      <SelectParameters>
                          <asp:ControlParameter ControlID="RadComboBoxPolice" Name="politicId" PropertyName="SelectedValue"
                              Type="Int32" />
                          <asp:ControlParameter ControlID="LabelOwnGName" Name="ownGName" PropertyName="Text"
                              Type="String" />
                      </SelectParameters>
                  </asp:ObjectDataSource>
              </td>
          </tr>
          <tr>
              <td>
                  <asp:Label ID="LabelOwnGName" runat="server" />
                  <asp:ObjectDataSource ID="ObjectDataSourceGrPolices" runat="server" SelectMethod="SelectGroupPolices"
                      TypeName="Scheduler.WebClient.Controller"></asp:ObjectDataSource>
              </td>
              <td>
                 <telerik:RadComboBox ID="RadComboBoxPolice" runat="server" DataSourceID="ObjectDataSourceGrPolices"
                      DataTextField="Name" DataValueField="Id" AutoPostBack="True" Width="100px">
                  </telerik:RadComboBox>
              </td>
          </tr>
      </table>
      </div>
  <br />
  <div class="field-center-error">
      <asp:Label ID="LabelMessage" runat="server" ClientIDMode="Static" />
  </div>

It's my RadListBox methods:
protected void RadListBoxADGroupsTransferred(object sender, Telerik.Web.UI.RadListBoxTransferredEventArgs e)
{
   if (e.DestinationListBox != sender)
    {
    foreach (var grpIns in  e.Items.Select(item => new Group { Name = item.Text,
GroupPoliceId = Convert.ToInt32(RadComboBoxPolice.SelectedValue) }) )
        {
          _sc.InsertGroup(grpIns);
        }
        LabelMessage.Text = Controller.Message;
        RadListBoxGroups.DataBind();
    }
}
protected void RadListBoxGroupsDeleted(object sender, Telerik.Web.UI.RadListBoxEventArgs e)
{
  foreach (var grpDel in e.Items.Select(item => new Group { Id = Convert.ToInt32(item.Value),
Name = item.Text }))
    {
      _sc.DeleteGroup(grpDel);
    }
    LabelMessage.Text = Controller.Message;
    RadListBoxGroups.DataBind();
}
Anatoliy
Top achievements
Rank 2
 answered on 05 Nov 2012
1 answer
104 views
I have created a treeview that binds to an xml data source (I followed the instructions on the following page: http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/xmlfile/defaultcs.aspx). If the 'ExpandMode' property in the data bindings is not set then the data is displayed by the treeview as expected - however, the server postback doesn't work correctly when you click on a node. If you set the ExpandMode property to 'ServerSide' the treeview does not populate correctly.

What am I doing wrong?

        <telerik:RadTreeView ID="XmlRadTreeView" runat="server"
            DataSourceID="TreeViewDataSource"
            DataFieldID="Text"
            DataFieldParentID="Text"
            PersistLoadOnDemandNodes="true"
            Width="550px"
            Height="350px"
            BorderStyle="Solid"
            BorderWidth="1px"
            Font-Size="14px"
            Font-Names="Bookman Old Style"
            BackColor="White"
            EnableViewState="true"
            OnNodeCollapse="XmlRadTreeView_NodeCollapse"
            OnNodeExpand="XmlRadTreeView_NodeExpand"
            OnNodeClick="XmlRadTreeView_NodeClick">
            <DataBindings>
                <telerik:RadTreeNodeBinding DataMember="Node" PostBack="true" ValueField="ID" TextField="Text" ImageUrlField="ImageUrl" ExpandedField="Expanded" ExpandMode="ServerSide"></telerik:RadTreeNodeBinding>
            </DataBindings>
            <NodeTemplate>
                <div class="CustomClass">
                    <%# DataBinder.Eval(Container, "Text") %>
                </div>
            </NodeTemplate>
        </telerik:RadTreeView>
Boyan Dimitrov
Telerik team
 answered on 05 Nov 2012
3 answers
87 views
So I have a custom attribute "typeFilter" on my scheduler object.  I have a tabpanel and when a different tab is selected, the customattribute in the scheduler changes and then I call rebind().  However, in my webservice getAppointments() function, the scheduler.attributes list is always 0.  Do I have to do something else to make sure the call to the webservice has the attributes filled in?

Thank you
Loren
Boyan Dimitrov
Telerik team
 answered on 05 Nov 2012
1 answer
92 views
I believe I have read all of the post's in here about getting the height set so it fills the screen.  I have applied Height: 100% to all of the pieces of the splitter and I have also written some jQuery to help with the sizing issue.  All works fine in FireFox but not in IE (currently using IE 8).  Here is the HTML and the jQuery is below.

HTML
<div id="main" class='column last span-19'>
    <telerik:RadDockLayout ID="rdlSliders" runat="server" OnSaveDockLayout="rdlSliders_SaveDockLayout"
                           OnLoadDockLayout="rdlSliders_LoadDockLayout">
        <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="1252" OnClientLoaded="splitterLoaded" Height="100%">
            <telerik:RadPane ID="LeftPane" runat="server" Width="22" Scrolling="None" Height="100%">
                <telerik:RadSlidingZone ID="SlidingZone1" runat="server"
                                        Width="22" Height="100%">
                    <telerik:RadSlidingPane ID="rspDefault1" Title="Landing Area" runat="server" Width="300px"
                                            OnClientResized="resizepane" OnClientExpanded="resizepane">
                        <telerik:RadDockZone ID="rdzCapacity" runat="server" Width="290px"
                                             UniqueName="Capacity" Height="100%">
                        </telerik:RadDockZone>
                    </telerik:RadSlidingPane>
                </telerik:RadSlidingZone>
            </telerik:RadPane>
            <telerik:RadSplitBar ID="RadSplitbar1" runat="server"></telerik:RadSplitBar>
            <telerik:RadPane ID="MainPane" runat="server" Height="100%">
                <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="99%" SelectedIndex="0" Height="100%">
                </telerik:RadMultiPage>
            </telerik:RadPane>
        </telerik:RadSplitter>
    </telerik:RadDockLayout>
</div>

jQuery
$(document).ready(function () {
    var windowheight = $(window).height();
    $("RadSplitter1").height((windowheight - 136));
    $("#SlidingZone1").height((windowheight - 136));
    $("#MainPane").height((windowheight - 136));
    $("#rspDefault1").height((windowheight - 136));
});
Vessy
Telerik team
 answered on 05 Nov 2012
1 answer
45 views
I created two functions to expand and collapse a row in a RadGrid control.
It works well in IE9, Firefox and Chrome, but it fails in IE8.
The $telerik object returns as undefined.
v 2012.1.411.35

function rgOption_Expanded(sender, args) {
    
    var item = args.get_item();
    var label = $telerik.findElement(item.get_element(), "options");
    label.style.display = "block";


}
function rgOption_Collapsed(sender, args) {


    var item = args.get_item();
    var label = $telerik.findElement(item.get_element(), "options");
    label.style.display = "none";


}
Eyup
Telerik team
 answered on 05 Nov 2012
1 answer
125 views
Good Morning, I am having an issue with a grid that has fixed headers and has grouping enabled. Everything aligns correctly until the grouping is collapsed to where there is no vertical scrollbar. When this happens the header and the cells become misaligned (see screenshot). Is there anyway to fix this issue? 

<telerik:RadGrid ID="grdLabs" runat="server" Skin="grid" EnableEmbeddedSkins="False" SelectedItemStyle-CssClass="SelectedStyle"
                AllowMultiRowSelection="True" AllowSorting="False" CellSpacing="0" GridLines="None" AllowPaging="false"
                AutoGenerateColumns="False" GroupingEnabled="True" Height="100%" Width="100%"  EnableAJAX="false">
                <MasterTableView ShowHeadersWhenNoRecords="True" GroupLoadMode="Client" TableLayout="Auto">
                    <GroupHeaderTemplate>
                    <span style="font-weight: bold;">
                        <%# Eval("CategoryType")%></span>
                </GroupHeaderTemplate>
                                    <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldName="CategoryType" HeaderText="" />
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="CategorySeq" HeaderText="" />
                        </GroupByFields>
                    </telerik:GridGroupByExpression>
                                         
                </GroupByExpressions>
                    <NoRecordsTemplate>
                        No results
                    </NoRecordsTemplate>
                </MasterTableView>
                <ClientSettings Resizing-AllowColumnResize="False" Resizing-ResizeGridOnColumnResize="False" AllowGroupExpandCollapse="True" AllowExpandCollapse="False">
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="False"></Selecting>
                    <Scrolling AllowScroll="True" UseStaticHeaders="False" SaveScrollPosition="True" FrozenColumnsCount="0"/>
                </ClientSettings>
                <GroupingSettings ShowUnGroupButton="true" />
                <PagerStyle Mode="NumericPages" Position="Top" PagerTextFormat="{4} Page {0} of {1}, results {2} to {3} of {5}." />
            </telerik:RadGrid>
Eyup
Telerik team
 answered on 05 Nov 2012
1 answer
99 views
I am trying the following example (tooltipmanager) but my code differs a bit as I am trying to add RadEditor control inside the ascx page.
http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=grid

On tooltip, it opens my ascx page and displays the radeditor control but it does not allow me to type anything in the "design" view (somehow it seems to be disabled).
When i type in "html" view and come back to "design" view, it still does not show any text in the design view.

Is there something different or special that needs to be done when implementing a radeditor in the above mentioned scenario.

Thanks
Ajay
Marin Bratanov
Telerik team
 answered on 05 Nov 2012
0 answers
123 views
hi , kindly help me . i want show tooltip beside textbox in radgrid in edit mode and show or hide it from client functions \
what i made i added tooltip and set the target control (textbox) and it works fine but when the tootip show and make scroll in radgrid the 
tootip still at the first position  not move with textbox although the tooltip relative to element 
Ashraf
Top achievements
Rank 2
 asked on 05 Nov 2012
1 answer
112 views
Hi,

I'm attempting to dynamically create a RadContextMenu inside an asp.net server control. Whilst the Context Menu appears to be created/rendered correctly, I am unable to get any menu items to actually create. Checking the rendered markup - it appears that these items never actually make it onto the page.

Below is a sample of my code, can anyone indicate what I am doing wrong?

Imports System.Web.UI.WebControls
Imports Telerik.Web.UI
 
<ParseChildren(True, "MenuItems")>
Public Class SplitButton
    Inherits WebControl
 
    Private _MenuItems As New List(Of MenuItem)
    Private _Button As RadButton
    Private _ContextMenu As RadContextMenu
 
    Public Property MenuItems() As List(Of MenuItem)
        Get
            Return _MenuItems
        End Get
        Set(ByVal value As List(Of MenuItem))
            _MenuItems = value
        End Set
    End Property
 
    Public Property Text As String
    Public Property IconUrl As String
 
    Private Sub BuildContextMenu()
        _ContextMenu = New RadContextMenu() With {.ID = String.Format("{0}_Menu", Me.ID)}
        Me.Controls.Add(_ContextMenu)
 
        Dim x As New List(Of RadMenuItem)
 
        For Each item As MenuItem In MenuItems
            Dim menuItem As New RadMenuItem() With {.Text = item.Text, .Value = item.Value, .Visible = item.Visible, .ImageUrl = item.IconUrl, .PostBack = item.PostBack}
 
            x.Add(menuItem)
        Next
 
        _ContextMenu.Items.AddRange(x)
 
 
    End Sub
 
    Private Sub BuildButton()
        _Button = New RadButton() With {.ID = String.Format("{0}_Button", Me.ID)}
 
        _Button.OnClientClicked = "SplitButton_OnClientClicked"
        _Button.Attributes.Add("data-contextmenu", _ContextMenu.ClientID)
        _Button.Text = Text
        _Button.Icon.PrimaryIconUrl = IconUrl
        _Button.EnableSplitButton = True
 
        Me.Controls.Add(_Button)
    End Sub
 
    Private Sub SplitButton_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init
        BuildContextMenu()
    End Sub
 
    Private Sub SplitButton_PreRender(ByVal Sender As Object, ByVal e As EventArgs) Handles Me.PreRender
 
        BuildButton()
    End Sub
 
End Class
 
Public Class MenuItem
 
    Public Property IconUrl As String
    Public Property Text As String
    Public Property Value As String
    Public Property PostBack As Boolean
    Public Property Visible As Boolean
 
End Class

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="Grid_SplitButtonDemo.WebForm1" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<%@ Register Assembly="GridSplitButtonDemo" Namespace="Grid_SplitButtonDemo" TagPrefix="a" %>
 
<head runat="server">
    <title>SplitButton Demo</title>
    <script type="text/javascript">
        function SplitButton_OnClientClicked(sender, args)
        {
            //Check if we clicked the splitbutton portion, or the button portion
            if (args.IsSplitButtonClick())
            {
                //Show the context menu below the selected button.
                var currentLocation = $telerik.getLocation(sender.get_element());
                var contextMenu = $find(sender.get_element().getAttribute('data-contextmenu'));
                //alert(contextMenu.get_items().get_count());
                contextMenu.showAt(currentLocation.x, currentLocation.y + 22);
 
                //Prevent postback.
                sender.set_autoPostBack(false);
            }
            else
            {
                //Button portion clicked, Perform the default action.
                alert("Perform Default Action");
                sender.set_autoPostBack(true);
            }
        }
    </script>
</head>
<body>   
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <h2>
        SplitButton Demo
    </h2>
    <div>
        <a:SplitButton runat="server" ID="btnActions" Text="Edit" IconUrl="Images/pencil.png">
            <a:MenuItem IconUrl="Images/Remove.png" Text="Delete" Value="Delete" PostBack="false" />
            <a:MenuItem IconUrl="Images/wand.png" Text="Add Another" Value="NewAnother" />
        </a:SplitButton>
    </div>
    </form>
</body>
</html>

Thanks
Fergal
Kate
Telerik team
 answered on 05 Nov 2012
6 answers
245 views
Hello -- I have a page with three tabs.  Each tab has an instance of RadEditor in it.  I have added custom buttons to the toolbar.  These buttons are added in code behind with the code -- 

void LoadCustomButton(stirng name, string text, string backgroundImageUrl) {
         EditorToolGroup dynamicToolBar  new EditorToolGroup();
         This.RadEditor1.Tools.Add(dynamicToolBar);

          EditorTool custom1 = new EditorTool();
          custom1.Name = name;
          custom1.Text = text;

//----------------------------------------------------------------------------
          // Want to be able to do something like the following ----
         //custom1.Style.BackgroundImageUrl = backgroundImageUrl;
//----------------------------------------------------------------------------

          dynamicToolBar.Tools.Add(custom1)
}

I need to set an image icon for this button.  I know how to do it in the page (using ,reTool .btnAdd { background-image:url(...);).
However, I need to do this dynamically and I don't know the name of the button until it is created.  Is there a way to set the icon in code-behind?

Thanks
Raka


Raka
Top achievements
Rank 1
 answered on 05 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?