Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
62 views
In our project, we've got a weppage with radgrid - one of its columns is templatecolumn with button inside. We're using onShow event set to "OnMouseOver" to displayo a tooltip. We noticed that some f our clients often click the button. When mouse starts to hover over the button but the tooltip isn't visible yet, they click the button which basically cancels the action of showing tooltip. It would be great if tooltip could ignore click on its parent in situation where it's already started to show due to onMouseOver action. Is it possible?
Svetlina Anati
Telerik team
 answered on 16 Dec 2010
5 answers
106 views
If you take the following code:
<telerik:Radslider id="slider2" runat="server" itemtype="Item" skin="Windows7" Height="40px">
  <Items>
    <telerik:RadSliderItem Value="1" Text="One" />
    <telerik:RadSliderItem Value="2" Text="Two" />
    <telerik:RadSliderItem Value="3" Text="Three" />
  </Items>
</telerik:Radslider>
<script type="text/javascript">
$(document).ready(function()
{
  $find('<%= slider2.ClientID %>').set_value(2);
});
</script>

and run it in a browser, it actually sets the slider to Item 3, not 2 as specified.
Is this a known issue or am I missing something here?
Tsvetie
Telerik team
 answered on 16 Dec 2010
3 answers
120 views
Hello,

I have a treeview in a combobox.
When i select a node, the node's text appears in the combobox input field.
In additional i set node's text as a tooltip.

1. Why the first line in the next code snippest doesn't work? (No tooltip appears)
//This line doesn't work for some reason that i don't know.
//comboBox.ToolTip = args.get_node().get_text();
  
//This line work's perfect.
comboBox._element.title = args.get_node().get_text();

2. I added an asp button to the page, after i click the button there is a postback that causes to the tooltip to disapear.
    How can i persist the tooltip?

Thanks,
Oren
Dimitar Terziev
Telerik team
 answered on 16 Dec 2010
1 answer
269 views
I realized I had posted this question in perhaps the wrong forum (here) so I am reposting here in hopes that someone might be able to answer this. Any help would be greatly appreciated!

I am trying to recreate functionality found in this demo from telerik.

When I attempt to drag and drop the available orders to shipped orders I receive an error:
Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex

I have modified very little from the default demo code.  The only change I have made is the GetOrder routine.  Here is my complete code:
<%@ Control Language="C#" ClassName="AddPortalDocs" Inherits="Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPartInfoProvider" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<telerik:RadAjaxManager runat="server" ID="radAjax" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="grdPendingOrders">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdPendingOrders" />
                <telerik:AjaxUpdatedControl ControlID="grdShippedOrders" />
                <telerik:AjaxUpdatedControl ControlID="msg" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="grdShippedOrders">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdShippedOrders" />
                <telerik:AjaxUpdatedControl ControlID="msg" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="UseDragColumnCheckBox">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdPendingOrders" />
                <telerik:AjaxUpdatedControl ControlID="grdShippedOrders" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadScriptBlock runat="server" ID="scriptBlock">
    <script type="text/javascript">
            <!--
        function onRowDropping(sender, args) {
            if (sender.get_id() == "<%=grdPendingOrders.ClientID %>") {
                var node = args.get_destinationHtmlElement();
                if (!isChildOf('<%=grdShippedOrders.ClientID %>', node) && !isChildOf('<%=grdPendingOrders.ClientID %>', node)) {
                    args.set_cancel(true);
                }
            }
            else {
                var node = args.get_destinationHtmlElement();
                if (!isChildOf('trashCan', node)) {
                    args.set_cancel(true);
                }
                else {
                    if (confirm("Are you sure you want to delete this order?"))
                        args.set_destinationHtmlElement($get('trashCan'));
                    else
                        args.set_cancel(true);
                }
            }
        }
 
        function isChildOf(parentId, element) {
            while (element) {
                if (element.id && element.id.indexOf(parentId) > -1) {
                    return true;
                }
                element = element.parentNode;
            }
            return false;
        }
                -->
    </script>
</telerik:RadScriptBlock>
<div style="float: left; padding: 0 6px 0 10px">
    <h2 style="color: #9c3608">
        Pending Orders</h2>
    <telerik:RadGrid runat="server" ID="grdPendingOrders" OnNeedDataSource="grdPendingOrders_NeedDataSource"
        AllowPaging="True" Width="350px" OnRowDrop="grdPendingOrders_RowDrop" AllowMultiRowSelection="true"
        PageSize="30" EnableHeaderContextMenu="true">
        <MasterTableView DataKeyNames="OrderId" TableLayout="Fixed">
            <Columns>                       
            </Columns>
        </MasterTableView>
        <ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
            <Resizing AllowColumnResize="true" />
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
            <ClientEvents OnRowDropping="onRowDropping" />
            <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
        </ClientSettings>
        <PagerStyle Mode="NumericPages" PageButtonCount="4" />
    </telerik:RadGrid>
</div>
<div style="float: right; padding: 0 10px 0 6px">
    <h2 style="color: #3c8b04">
        Shipped Orders</h2>
    <telerik:RadGrid runat="server" AllowPaging="True" ID="grdShippedOrders" OnNeedDataSource="grdShippedOrders_NeedDataSource"
        Width="350px" OnRowDrop="grdShippedOrders_RowDrop" AllowMultiRowSelection="true">
        <MasterTableView DataKeyNames="OrderId" Width="100%">
            <Columns>                       
            </Columns>
            <NoRecordsTemplate>
                <div style="height: 30px; cursor: pointer;">
                    No items to view</div>
            </NoRecordsTemplate>
            <PagerStyle Mode="NumericPages" PageButtonCount="4" />
        </MasterTableView>
        <ClientSettings AllowRowsDragDrop="True">
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
            <ClientEvents OnRowDropping="onRowDropping" />
        </ClientSettings>
    </telerik:RadGrid>
</div>
<div style="clear: both;">
    <!-- -->
</div>
<asp:Image runat="server" ID="trashcan" ImageUrl="~/images/icons/recycle-bin-icon-32.gif" ToolTip="Drag selected accounts to here to remove them." />
 
<script runat="server" type="text/C#">
 
     
    public override Sage.Platform.Application.UI.ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType)
    {
        Sage.Platform.WebPortal.SmartParts.ToolsSmartPartInfo ti = new Sage.Platform.WebPortal.SmartParts.ToolsSmartPartInfo();
        ti.Title = "Test";
        return ti;
    }
 
    public Sage.Entity.Interfaces.IAccount CurrentEntity
    {
        get { return this.BindingSource.Current as Sage.Entity.Interfaces.IAccount; }
    }
 
    protected void Page_Load(object sender, EventArgs e)
    { }
 
    protected void Page_Init(object sender, EventArgs e)
    { }
 
    protected void Page_PreRender(object sender, EventArgs e)
    { }
 
    [Sage.Platform.Application.ServiceDependency]
    public new Sage.Platform.Application.IEntityContextService EntityContext { set; get; }
 
    public override Type EntityType
    {
        get { return typeof(Sage.Entity.Interfaces.IAccount); }
    }
 
    protected override void OnAddEntityBindings()
    { }
 
    protected override void OnFormBound()
    {
        base.OnFormBound();
    }
 
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
    protected System.Collections.Generic.IList<Order> PendingOrders
    {
        get
        {
            try
            {
                object obj = Session["PendingOrders"];
                if (obj == null)
                {
                    obj = GetOrders();
                    if (obj != null)
                    {
                        Session["PendingOrders"] = obj;
                    }
                    else
                    {
                        obj = new System.Collections.Generic.List<Order>();
                    }
                }
                return (System.Collections.Generic.IList<Order>)obj;
            }
            catch
            {
                Session["PendingOrders"] = null;
            }
            return new System.Collections.Generic.List<Order>();
        }
        set { Session["PendingOrders"] = value; }
    }
 
    protected System.Collections.Generic.IList<Order> ShippedOrders
    {
        get
        {
            try
            {
                object obj = Session["ShippedOrders"];
                if (obj == null)
                {
                    Session["ShippedOrders"] = obj = new System.Collections.Generic.List<Order>();
                }
                return (System.Collections.Generic.IList<Order>)obj;
            }
            catch
            {
                Session["ShippedOrders"] = null;
            }
            return new System.Collections.Generic.List<Order>();
        }
        set { Session["ShippedOrders"] = value; }
    }
 
    protected void grdPendingOrders_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        grdPendingOrders.DataSource = PendingOrders;
    }
 
    protected System.Collections.Generic.IList<Order> GetOrders()
    {
        System.Collections.Generic.IList<Order> results = new System.Collections.Generic.List<Order>();
        int i = 0;
        Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IAccount> repository = Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IAccount>();
        Sage.Platform.Repository.ICriteria criteria = repository.CreateCriteria();
        criteria.AddOrder(repository.EF.Asc("AccountName"));
        System.Collections.Generic.IList<Sage.Entity.Interfaces.IAccount> accounts = criteria.List<Sage.Entity.Interfaces.IAccount>();
        foreach (Sage.Entity.Interfaces.IAccount acc in accounts)
        {
            int id = (int)i;
            string customerID = acc.Id.ToString();
            DateTime requiredDate = acc.CreateDate.Value;
            string companyName = acc.AccountName;
            results.Add(new Order(id, customerID, companyName, requiredDate.ToShortDateString()));
            i++;
        }
        return results;
    }
 
    protected void grdShippedOrders_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        grdShippedOrders.DataSource = ShippedOrders;
    }
 
    protected void grdPendingOrders_RowDrop(object sender, GridDragDropEventArgs e)
    {
        if (string.IsNullOrEmpty(e.HtmlElement))
        {
            if (e.DraggedItems[0].OwnerGridID == grdPendingOrders.ClientID)
            {
                // items are drag from pending to shipped grid
                if ((e.DestDataItem == null && ShippedOrders.Count == 0) ||
                    e.DestDataItem != null && e.DestDataItem.OwnerGridID == grdShippedOrders.ClientID)
                {
                    System.Collections.Generic.IList<Order> shippedOrders = ShippedOrders;
                    System.Collections.Generic.IList<Order> pendingOrders = PendingOrders;
                    int destinationIndex = -1;
                    if (e.DestDataItem != null)
                    {
                        Order order = GetOrder(shippedOrders, (int)e.DestDataItem.GetDataKeyValue("OrderId"));
                        destinationIndex = (order != null) ? shippedOrders.IndexOf(order) : -1;
                    }
 
 
                    foreach (GridDataItem draggedItem in e.DraggedItems)
                    {
                        Order tmpOrder = GetOrder(pendingOrders, (int)draggedItem.GetDataKeyValue("OrderId"));
 
                        if (tmpOrder != null)
                        {
                            if (destinationIndex > -1)
                            {
                                if (e.DropPosition == GridItemDropPosition.Below)
                                {
                                    destinationIndex += 1;
                                }
                                shippedOrders.Insert(destinationIndex, tmpOrder);
                            }
                            else
                            {
                                shippedOrders.Add(tmpOrder);
                            }
 
                            pendingOrders.Remove(tmpOrder);
                        }
                    }
 
                    ShippedOrders = shippedOrders;
                    PendingOrders = pendingOrders;
                    grdPendingOrders.Rebind();
                    grdShippedOrders.Rebind();
                }
                else if (e.DestDataItem != null && e.DestDataItem.OwnerGridID == grdPendingOrders.ClientID)
                {
                    //reorder items in pending grid
                    System.Collections.Generic.IList<Order> pendingOrders = PendingOrders;
                    Order order = GetOrder(pendingOrders, (int)e.DestDataItem.GetDataKeyValue("OrderId"));
                    int destinationIndex = pendingOrders.IndexOf(order);
 
                    if (e.DropPosition == GridItemDropPosition.Above && e.DestDataItem.ItemIndex > e.DraggedItems[0].ItemIndex)
                    {
                        destinationIndex -= 1;
                    }
                    if (e.DropPosition == GridItemDropPosition.Below && e.DestDataItem.ItemIndex < e.DraggedItems[0].ItemIndex)
                    {
                        destinationIndex += 1;
                    }
 
                    System.Collections.Generic.List<Order> ordersToMove = new System.Collections.Generic.List<Order>();
                    foreach (GridDataItem draggedItem in e.DraggedItems)
                    {
                        Order tmpOrder = GetOrder(pendingOrders, (int)draggedItem.GetDataKeyValue("OrderId"));
                        if (tmpOrder != null)
                            ordersToMove.Add(tmpOrder);
                    }
 
                    foreach (Order orderToMove in ordersToMove)
                    {
                        pendingOrders.Remove(orderToMove);
                        pendingOrders.Insert(destinationIndex, orderToMove);
                    }
                    PendingOrders = pendingOrders;
                    grdPendingOrders.Rebind();
 
                    int destinationItemIndex = destinationIndex - (grdPendingOrders.PageSize * grdPendingOrders.CurrentPageIndex);
                    e.DestinationTableView.Items[destinationItemIndex].Selected = true;
                }
            }
        }
    }
 
    private static Order GetOrder(System.Collections.Generic.IEnumerable<Order> ordersToSearchIn, int orderId)
    {
        foreach (Order order in ordersToSearchIn)
        {
            if (order.OrderID == orderId)
            {
                return order;
            }
        }
        return null;
    }
 
    protected void grdShippedOrders_RowDrop(object sender, GridDragDropEventArgs e)
    {
        if (!string.IsNullOrEmpty(e.HtmlElement) && e.HtmlElement == "trashCan")
        {
            System.Collections.Generic.IList<Order> shippedOrders = ShippedOrders;
            bool deleted = false;
            foreach (GridDataItem draggedItem in e.DraggedItems)
            {
                Order tmpOrder = GetOrder(shippedOrders, (int)draggedItem.GetDataKeyValue("OrderId"));
 
                if (tmpOrder != null)
                {
                    shippedOrders.Remove(tmpOrder);
                    deleted = true;
                }
            }
            if (deleted)
            {
                DialogService.ShowMessage("Deleted");
            }
            ShippedOrders = shippedOrders;
            grdShippedOrders.Rebind();
        }
    }
 
    #region Nested type: Order
 
    protected class Order
    {
        private string _companyName;
        private string _customerId;
        private int _orderId;
        private string _date;
 
        public Order(int orderId, string customerId, string companyName, string requiredDate)
        {
            _orderId = orderId;
            _customerId = customerId;
            _companyName = companyName;
            _date = requiredDate;
        }
 
        public int OrderID
        {
            get { return _orderId; }
        }
 
        public string CustomerID
        {
            get { return _customerId; }
        }
 
        public string Company
        {
            get { return _companyName; }
        }
 
        public string Date
        {
            get { return _date; }
        }
    }
 
    #endregion
  
</script>
 
              
   

The complete server error is:

2010-12-13 11:50:10,491 ERROR Global - Unhandled exception.
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex
   at Telerik.Web.UI.GridItemCollection.get_Item(String hierarchicalIndex)
   at Telerik.Web.UI.GridDataItemCollection.get_Item(String hierarchicalIndex)
   at Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Maria Ilieva
Telerik team
 answered on 16 Dec 2010
1 answer
142 views
Hello

I am using the dynamic data controlls for my admin section and where i am using a radlistview to show the detailed items.
When i give the datasource Id and all , it doesn't show any contents and it says it is not having any itemtemplate.But as it is a dynamic datacontrolls i can't add specific template items.How can i get the auto generated walues from the dynamic data items in the RADLISTView.

Please help.

Nikolay Rusev
Telerik team
 answered on 16 Dec 2010
1 answer
33 views
I have the following 2 column definitions in a grid.  When the grid displays there is no data in the DateTime column, but the calculated field is populated correctly.

If I delete the calculated column then the DateTime column works correctly.

What is wrong with the calculated column definition?

Mike

<telerik:GridDateTimeColumn UniqueName="GridRestoreTmstmp" DataFormatString="{0:MM/dd/yyyy H:mm:ss}" HeaderText="Restored" DataField="restoreTimestamp" >
    <HeaderStyle Width="70px" />
</telerik:GridDateTimeColumn>
<telerik:GridCalculatedColumn DataFields="customersRestored, customersRestoredAdjustment"
    DataType="System.Int32" Expression="({0}+{1})" HeaderText="Customers Restored"
    UniqueName="GridCustomersRestored" >
    <HeaderStyle Width="40px" HorizontalAlign="Right" />
</telerik:GridCalculatedColumn>
Maria Ilieva
Telerik team
 answered on 16 Dec 2010
4 answers
112 views
Hi,

I am implementing the RadEditor in RadWindow code example into my application. In your example you are only displaying one RadEditor that is on the Default.aspx page in the RadWindow. In my case I have 8 RadEditors on the same Default.aspx page and I need to display each of them in the same RadWindow, only one at a time of course. I will show you the code I am using below. Please assist.

        DefaultCS.aspx:

        function SetEditorContent(content)
        {            
           $find(
"<%=MyRadEditorOnPage1.ClientID%>").set_html(content);  //set content to RadEditor on the mane page from RadWindow
       
}

        EditorInWindow.aspx

        function setContent(content)
    {
     var editor = $find("<%= editor1.ClientID %>");
         if (editor) editor.set_html(content); 
    }



How do I do this for MyRadEditorOnPage2 - 8? Would some kind of a switch() statment work?

Thanks,


Steve Holdorf
Top achievements
Rank 1
 answered on 16 Dec 2010
1 answer
85 views
Hi,

I want to add an additional column to Calendar, just like in attached image. I tried to use ShowRowHeaders but I don't know how to move column to the right side.

Best Regards,
Artek
Tsvetina
Telerik team
 answered on 16 Dec 2010
3 answers
120 views
hi guys.

i have a Dock that contain a user control that this usercontrol contain a radMenu.
when sub menu is open, menu goes under radDock and some times scrolling.
how i can fix it that dont goes under DIV?


tnx

regards
Pero
Telerik team
 answered on 16 Dec 2010
3 answers
102 views
Hi,

I've managed to make a grid work with a subgrid and popup admin forms for the two levels.  Now that I have it largely working I am looking at making it more usable for the end user.  As it stands with command bars it looks very complex so I've kept the command bar on the top of the grid, that is fine for adding new elements to level 1.  On the second level I decided that the command bar was wasting too much space so I have put a + button in each row in level 1 - this can be seen in the attached screenshot.

The problem that I have is by moving the + button to the row the code that handles default checkbox config on the form template now fails. My insert form code is shown below - the top part handles creation of the form for the level 1 grid while the second one (with a renamed CommandName) needs to open the child grids insert form.  

I think that I'm just tired but cannot figure out howto get the child form open.  

Any pointers?

Regards,

Jon

Private Sub uxRadGrid_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles uxRadGrid.ItemCommand
        If e.CommandName = Telerik.Web.UI.RadGrid.InitInsertCommandName Then
            e.Canceled = True
            Dim newValues As System.Collections.Specialized.ListDictionary = New System.Collections.Specialized.ListDictionary()
            newValues("ShowTotal") = False
            newValues("IncludeInGrandTotal") = False
            e.Item.OwnerTableView.InsertItem(newValues)
        ElseIf e.CommandName = "InitInsertElement" Then
            e.Canceled = True
            Dim newValues As System.Collections.Specialized.ListDictionary = New System.Collections.Specialized.ListDictionary()
            newValues("IncludeInTotal") = False
' FOLLOWING LINE CRASHES BECAUSE IT IS INSERTING IN THE LEVEL 1 GRID - NOT THE CHILD GRID.  
' NEED CODE FOR OPENING CHILD INSERT FORM
            e.Item.OwnerTableView.InsertItem(newValues)
        ElseIf (e.CommandName = "Update" OrElse
.... rest irrelevant
Jon
Top achievements
Rank 1
 answered on 16 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?