Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
179 views
Here is my situation. I have a tree that uses load on demand. The first level is Offices and the second level are Contacts in corresponding offices.
Now, the data source for the offices also returns the number of contacts in the office, which is helpful for this load on demand scenario (the user now knows if the office has nodes in it). However, to display the number in a different color beside the office title, I need to use a template of the Office Nodes. But I want the Contact Nodes below to be regular RadTreeNodes. Now I got it working one way programmatically, but I feel using template on the ASPX side would faster.

Here is my attempt at the ASPX side, which is completely broken and completely wrong, but I'm using it to give you a sense of where I am going.
<telerik:RadTreeView ID="_tvOffice" AutoPostBack="true" Width="100%" Skin="Office2007"
            EnableDragAndDropBetweenNodes="true" EnableDragAndDrop="True"
            runat="server"
            DataFieldID="ID" ContextMenuItemClick="_tvOffice_ContextMenuItemClick" OnNodeExpand="_tvOffice_NodeExpand">
           <NodeTemplate>
                <telerik:RadTreeNode runat="server">
                </telerik:RadTreeNode>
            </NodeTemplate>
            <Nodes>
                <telerik:RadTreeNode EnableContextMenu="false" CssClass="spIcon spFldr_C" AllowDrag="false"
                    AllowDrop="true" ExpandMode="ServerSideCallBack" runat="server">
                    <NodeTemplate>
                        <asp:Label ID="_lblTitle" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.officeTitle")%>'></asp:Label>
                        <asp:Label ID="_lblCount" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.ContactCount", "({0})")%>'
                            CssClass="lblProjectNum"></asp:Label>
                    </NodeTemplate>
                </telerik:RadTreeNode>
            </Nodes>
            <DataBindings>
              <telerik:RadTreeNodeBinding Depth="0" EnableContextMenu="false" CssClass="spIcon spFldr_C" AllowDrag="false"
                    AllowDrop="true" ExpandMode="ServerSideCallBack" TextField="officeTitle" ValueField="ID" CategoryField="Category" />
            </DataBindings>
        </telerik:RadTreeView>

private void RebindOfficeTree(int? companyId)
        {
            if (companyId == null) return;
            
            var db = new DBStoredProc();
            var officeList = db.Offices_OnDemand(companyId);
            _tvOffice.DataSource = officeList;
            _tvOffice.DataBind();
        }
 
private static void PopulateContactsByOffice(RadTreeNodeEventArgs e)
        {
            if (e == null || e.Node.Value == null) return;
 
            var db = new DataContext();
            var officeId = int.Parse(e.Node.Value);
            var contactList = Contacts.LoadByOfficeId(db, officeId);
 
            foreach (var contact in contactList)
            {
                var node = new RadTreeNode
                {
                    Text = contact.FullName,
                    Value = contact.Id.ToString(),
                    CssClass = "spIcon spContact",
                    Category = "Contact",
                    AllowDrag = true,
                    AllowDrop = false
                };
                e.Node.Nodes.Add(node);
            }
            e.Node.Expanded = true;
        }


Also, I am grabbing the offices by clicking on a Company Node on another tree, but using per-node template, a "blank" tree node appears in the Office tree on page load (before selecting any company).

The point here is speed. I want to use the fastest, most optimized method to do this.
Nikolay Tsenkov
Telerik team
 answered on 15 Aug 2011
1 answer
163 views
Dear Telerik team,

As I have to purchase the ASP.NET Ajax Controls of Telerik, i have below clarification.. Pls clarify me.

I will buy the developer license for the ASP.NET Ajax Controls.
Should I purchase the client license for the same while implementing in the client machine?
Is the developer license included the client license also?
Kindly clarify me.. I need to approach the top level management of my concern to purchase the telerik package.
Emilia
Telerik team
 answered on 15 Aug 2011
1 answer
73 views
Greetings,
Please i have the following bug when using the ColorPicker with a right to left page and the ShowIcon property is set to true, the selected color is not appearing on the icon (the color of the icon is always white).
Slav
Telerik team
 answered on 15 Aug 2011
2 answers
97 views
On the server side, I've built a RadTreeView whose nodes have attributes.

RadTreeView tree = new RadTreeview();
tree.ID = "MyRadTree";
tree.WebServiceSettings.Path = "MyServices.svc";
tree.WebServiceSettings.Method = "GetNodes"
...
RadTreeNode nodes = new RadTreeNode();
...
RadTreeNode expandNode1 = new RadTreeNode();
expandNode1.Text = "Apples";
expandNode1.Value = "1";
expandNode1.Attributes.Add("NodeType", "Fruit");
expandNode1.ExpandNode = TreeNodeExpandNode.WebService;
...
tree.Nodes.AddRange(nodes);

My service, GetNodes(), is called, but the node.Attributes count is 0.

[OperationContract]
public RadTreeNodeData[] GetNodes(RadTreeNodeData node, IDictionary<string, object> context)
{
   string value = node.Value; // ok
   string text = node.Text; // ok
   int attributeCount = node.Attributes.Count; // 0
   string attribute = node.Attributes["NodeType"]; // Exception "The given key was not present in the dictionary"
}

Is this supposed to work?  Any ideas what I could be missing?  Might I need to add a [WebInvoke ...] attribute to my web method, perhaps changing the method style?

(Note that the attribute(s) are available from the client side; they just don't seem to make it through to the web service.)

Thanks.
Nikolay Tsenkov
Telerik team
 answered on 15 Aug 2011
7 answers
189 views

Hello,

I use trial version of Web UI Controls & Components for ASP.NET AJAX. I’ve faced a problem with RadRotator animation. I use it in Web User Control. Here is the code for my control FabricItunes.ascx :

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FabricItunes.ascx.cs" Inherits="test.Controls.FabricItunes" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<style type="text/css">
    .rotWrapper
    {
        margin-left: auto;
        margin-right: auto;
        height: 260px;
        font-family: Arial;
        padding: 190px 0 0;
        width: 750px;
        background: #fff url("travel_back.jpg") no-repeat 0 0;
        font: 14px 'Segoe UI' , Arial, Sans-serif;
        color: #000;
    }       
    .RemoveRotatorBorder div.rrClipRegion
    {
        /* The following style removes the border of the rotator that is applied to the items wrapper DIV of the control by default, in case the control renders buttons.
        In case you want to removed this border, you can safely use this CSS selector. */
        border: 0px none;
    }
</style>
 
<telerik:RadRotator ID="RadRotator1"
                    runat="server"
                    Width="575px"
                    ItemWidth="140px"
                    Height="130px"
                    ItemHeight="86px"
                    FrameDuration="100000"
                    PauseOnMouseOver="False"
                    RotatorType="CoverFlow"                    
                    CssClass="RemoveRotatorBorder"
                    Skin="Web20"
                    WrapFrames="False"                    
                    onitemclick="RadRotator1_ItemClick">
    <ItemTemplate>
        <asp:Image ID="Image1" runat="server" ImageUrl='<%# Container.DataItem %>' AlternateText="<%# VirtualPathUtility.GetFileName(Container.DataItem.ToString()) %>" />
        <asp:Label ID="Label1" runat="server" Text="<%# VirtualPathUtility.GetFileName(Container.DataItem.ToString()).Substring(0, 3) %>"></asp:Label>
    </ItemTemplate>
</telerik:RadRotator>
 
<script type="text/javascript">
    //<![CDATA[
    // The set_scrollAnimationOptions method takes two arguments - the first one is the ClientID of the rotator, which we want to configure and the second one is
    // a hash table with the options we want to apply.
    Telerik.Web.UI.RadRotatorAnimation.set_scrollAnimationOptions("<%= RadRotator1.ClientID %>", // The ClientID of the RadRotator
                    {
                    minScale: 0.8, // The size scale [0; 1], applied to the items that are not selected.
                    yO: 60, // The offset in pixels of the center of the selected item from the top edge of the rotator.
                    xR: -30, // The offset in pixels between the selected items and the first item on the left and on the right of the selected item.
                    xItemSpacing: 50, // The offset in pixels between the items in the rotator.
                    matrix: { m11: 1, m12: 0, m21: -0.1, m22: 1 }, // The 2d transformation matrix, applied to the items that appear on the right of the selected item.
                    reflectionHeight: 0.5, // The height of the reflection
                    reflectionOpacity: 1 // The opacity, applied to the reflection
                }
                );  // end of animationOptions
     //]]>
</script>

The code behid is:

namespace test.Controls
{
  
    public class FabricChoosedEventArgs : EventArgs
    {
        private string _FabricCode;
        public string FabricCode
        {
            get { return _FabricCode; }
            set { _FabricCode = value; }
        }
    }
     
    public partial class FabricItunes : System.Web.UI.UserControl
    {
        public delegate void FabricChoosedEventHandler(object sender, FabricChoosedEventArgs e);
 
        public event FabricChoosedEventHandler OnFabricChoosed;
 
        string virtualPath = "~/Images/Fabrics/";
 
         
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                FabricColorID = 0;
                ConfigureRadRotator(FabricColorID);            }
        }
 
        public void ConfigureRadRotator(int FabricColorID)
        {
            RadRotator1.RotatorType = RotatorType.CoverFlow;
            RadRotator1.DataSource = GetFilesInFolder(virtualPath, FabricColorID);
            RadRotator1.InitialItemIndex = 0;
            RadRotator1.DataBind();
        }
 
        protected List<string> GetFilesInFolder(string folderVirtualPath, int FabricColorID)
        {
            testws ws = new testws();
            List<string> FL = new List<string>();
            FL = ws.FabricsByColor(FabricColorID).ToList();
            List<string> virtualPathsCollection = new List<string>();
            foreach (String path in FL)
            {
                string virtualPath = VirtualPathUtility.AppendTrailingSlash(folderVirtualPath) + System.IO.Path.GetFileName(path) + "_th.jpg";
                virtualPathsCollection.Add(virtualPath);
            }
            return virtualPathsCollection;
        }
 
        protected void RadRotator1_ItemClick(object sender, RadRotatorEventArgs e)
        {
            Label lbl = e.Item.FindControl("Label1") as Label;
                if (this.OnFabricChoosed != null)
                {
                    FabricChoosedEventArgs r = new FabricChoosedEventArgs();
                    r.FabricCode = lbl.Text;
                    this.OnFabricChoosed(this, r);
                }
        }
    }
}

Now when I place this web user control on Web Form Using Master Page it loads perfectly with needed animation effects firs time. But when I click a rotator item it causes page post back and rotator loses all its animation effects.

Here is the code for Web Form:

<%@ Page Title="" Language="C#" MasterPageFile="~/Shop.Master" AutoEventWireup="true" CodeBehind="Shop.aspx.cs" Inherits="test.Shop" %>
<%@ Register src="Controls/BuyItem.ascx" tagname="BuyItem" tagprefix="uc1" %>
<%@ Register src="Controls/FabricItunes.ascx" tagname="FabricItunes" tagprefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_MainArea" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
    <ContentTemplate>
        <uc3:BuyItem ID="BuyItem1" runat="server" />
    </ContentTemplate>
</asp:UpdatePanel>
<div id="pnlProductItunes">
    <asp:UpdatePanel runat="server" UpdateMode="Always">
    <ContentTemplate>
        <div style="height: 155px; margin-top: 35px;">
            <uc2:FabricItunes ID="FabricItunes" runat="server" />
        </div>
    </ContentTemplate>
    </asp:UpdatePanel>
</div>
</asp:Content>

The code behid is:

namespace test
{
    public partial class Shop : System.Web.UI.Page
    {
         
        protected void Page_Load(object sender, EventArgs e)
        {
            this.FabricColors.OnFabricColorChoosed += new test.Controls.FabricColors.FabricColorChoosedEventHandler(FabricColors_OnFabricColorChoosed);
            this.FabricItunes.OnFabricChoosed += new test.Controls.FabricItunes.FabricChoosedEventHandler(FabricItunes_OnFabricChoosed);
        }
 
        void FabricItunes_OnFabricChoosed(object sender, Controls.FabricChoosedEventArgs e)
        {
            this.BuyItem1.showFabricImage(e.FabricCode);
        }
   }
}

Please advise how to avoid this animation loosing.
Thanks in advance for any suggestion.

Niko
Telerik team
 answered on 15 Aug 2011
1 answer
211 views
i have a radmenu (skin/black) with a specific width (200px), problem is when a menu item is long and it wraps, the CSS sprite image - since its intended for single line menuItem i think, shows other image included in the sprite image  (please see attachment)

now, what i want to happen in when a menuItem wraps and more than one line, the arrow and the background fits perfectly or in the center.

 thanks in advance.

Edit: i'm just looking for a quick fix if there's any (i mean not changing the rmSprite entirely) Or back to square one and just custom the whole thing? hehe
Kate
Telerik team
 answered on 15 Aug 2011
2 answers
107 views
Hello,

I would like to reverse the sliding pane/spillters action.....well part of it. For example I would have a splitter, then a pane then a splitbar then a pane and done.
All this works fine with the split bar between the two panes with both panes visable. The split bar is set to collapse backward. So both panes are visable and when you click on the splitter the splitter moves to the bottom and the bottom pane is hidden.

This is exactly the opposite of what I want. What I would like is when the splitter is (not collapsed) ie between the two panes that the bottom pane be hidden and when the splitter is clicked the splitter draws down revealing the pane contents.

Also the PM would like me to override the default arrow image in the center of the splitter with text "More" and "Less" for the users. So for example when the splitter is at the bottom of the top pane (the top of the bottom pane) it would say More indicating there is more choices if you click. Then when the splitter is at the bottom switch it to say "Less" telling the user they can close up and hide some options.

TIA
JB
Ramjet
Top achievements
Rank 1
 answered on 15 Aug 2011
1 answer
120 views
Hello,

When I use the moss link manager, I want to set the defualt url for MOSS Asset Picker dialog. I have read some posts here, it's said that radeditor simply call MOSS Asset Picker dialog and insert the return value to the editor content. I want to know how to set the default url for the dialog, or what value have you passed when you call the dialog? Thank you very much.
Stanimir
Telerik team
 answered on 15 Aug 2011
1 answer
207 views
Hi,
Im new to telerik control, One of the requirement we got is to open  a radWindow , radwindow is present inside radAjaxpanel.
RadWindow should  be open up on Click of html button.Im successfully till that part, Now radwindow contains a treeview aong with ASO.NET button "OK" and cancel html button. On Click of Cancel radwindow as to close and dont refresh parent radajaxpanel. When the user clicks on "OK" server side functionality to performed and update the parent radajax panel. Can anytell me how to perform

I tried adding javascript 

 function OnClientClose()
{
    $find("<%=radPanel.ClientID%>").ajaxRequest("Rebind");
}

In the radAJAXPANEL  i added OnAjaxRequest but nothing is working
-Mahender
Marin Bratanov
Telerik team
 answered on 15 Aug 2011
5 answers
754 views
where do i find the available list of skin?
Jay Mathis
Top achievements
Rank 1
 answered on 15 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?