Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
69 views
I have a RadTree which is bound to a data source. I want to display the data associated with the first leaf node whenever a root node is selected. I am doing this using the following code:
var node = tree.get_selectedNodes()[0]; 
 
node.expand() 
 
//alert("node text = " + node.get_text() + "\nChild count: " + node.get_nodes().get_count()); 
 
             
 
            while (node.get_nodes().get_count() != 0)  
 
            { 
 
                node = node.get_nodes().getNode(0); 
 
                node.expand(); 
 
                //alert("node  = " + node.get_text() + "\nchild count = " + node.get_nodes().get_count()); 
 
            } 

I have debugged the code using Firebug and know that its working exactly as its supposed to. The problem I am facing is that whenever I am not in debug mode, if I expand the root node it just shows me the content associated with the root node. I even tried putting alert() statements after the node.expand() call and it shows no. of child nodes as 0, even though there are child nodes present. Also, the code works perfectly well if the root node is already expanded. Funny thing is, if I enable the first alert() call, the whole thing works perfectly!! Makes me believe there are timing issues with the expand() call. Any ideas? Thanks in advance!

Nikolay Tsenkov
Telerik team
 answered on 28 Jun 2010
1 answer
303 views
Hi There,

We are using RadTreeView as a replacement for the menu in SharePoint. It is connecting to a datasource we have generated from the SPSites, basically creating a new SiteMapProvider. This is all in code behind. We have set the ExpandMode to "ServerSideCallBack" for efficiency reasons. But when I navigate to child sites, it doesn't show the currently selected node when the page is loaded......how can we achieve this???

please help

Snippets:

SharePoint MasterPage:

<%@ Master language="C#" Inherits="Chisholm.SharePoint.MasterPages.StudentPortal, Chisholm.SharePoint.MasterPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=36b5e3431f62f80f" %>

...........................................

<telerik:RadTreeView ID="myLearningTreeView" runat="server" Skin="Office2007"
            DataSourceID="MyLearningDS"
            OnNodeExpand="NodeExpandHandler"
            MaxDataBindDepth="1"
            DataNavigateUrlField="Url"
            DataTextField="Title" DataValueField="Key" DataFieldID="Key"  EnableEmbeddedSkins="False" SingleExpandPath="True">
            <DataBindings>
    <telerik:RadTreeNodeBinding ExpandMode="ServerSideCallBack" Depth="0" />
   </DataBindings>
        </telerik:RadTreeView>
        <asp:SiteMapDataSource ID="MyLearningDS" runat="server"
                ShowStartingNode="false"
                StartFromCurrentNode="false"
                StartingNodeOffset="0"
                SiteMapProvider="MyPortalSiteMapProvider"
                StartingNodeUrl="/myLearning"/> 

............................


code behind: StudentPortal.cs

namespace

 

Chisholm.SharePoint.MasterPages

 

{

 

 

public class StudentPortal : MasterPage

 

{

 

 

protected global::Telerik.Web.UI.RadTreeView myLearningTreeView;

 

 

 

public RadTreeNode LastSelectedNode

 

{

 

 

get { return (RadTreeNode)ViewState["LastSelectedNode"]; }

 

 

 

set { ViewState["LastSelectedNode"] = value; }

 

}

 

 

 

public RadTreeView SiteMenu

 

{

 

 

get { return (RadTreeView)ViewState["SiteMenu"]; }

 

 

 

set { ViewState["SiteMenu"] = value; }

 

}

 

 

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

 

//if (!Page.IsPostBack)

 

 

 

//{

 

 

 

if ((SiteMenu!=null)&&(LastSelectedNode!=null))

 

{

 

 

// get the custom sql site map provider

 

 

SqlSiteMapProvider provider = ((SqlSiteMapProvider)SiteMap.Providers[

"MyPortalSiteMapProvider"]);

 

 

 

if (provider == null)

 

 

 

return;

 

 

 

// add a method to get chid nodes by Key

 

 

SiteMapNode siteNode = provider.FindSiteMapNodeFromKey(LastSelectedNode.Value);

 

if (siteNode == null)

 

 

 

return;

 

SiteMapNodeCollection childNodes = provider.GetChildNodes(siteNode);

 

 

if (childNodes.Count < 1)

 

 

 

return;

 

 

 

// NW: call FindSiteMapNodeFromKey() of the SiteMapProvider using

 

 

 

// the key obtained from the node that was clicked.

 

 

 

// The node that was clicked becomes the new parent of the children

 

 

 

// to be added to it from the database.

 

 

 

//

 

 

 

foreach (SiteMapNode child in childNodes)

 

{

 

 

// NW: The children are created based on the information obtained from

 

 

 

// the database.

 

 

 

//

 

 

 

// create a new node

 

 

RadTreeNode rtn =

new RadTreeNode()

 

{

Value = child.Key,

Text = child.Title,

ExpandMode = TreeNodeExpandMode.ServerSide,

 

//NW: This is overiden below.

 

 

NavigateUrl = child.Url,

LongDesc = child.Description

};

 

// with the same expand mode as the node currently expanding

 

 

rtn.ExpandMode = LastSelectedNode.ExpandMode;

 

// add the new node to the node that is expanding

 

 

LastSelectedNode.Nodes.Add(rtn);

}

 

// now that the nodes are added, change the current node's expand mode to client-side

 

 

LastSelectedNode.ExpandMode = TreeNodeExpandMode.ClientSide;

 

// signal that the node is now expanded

 

 

LastSelectedNode.Expanded =

true;

 

}

 

 

//}

 

 

}

 

protected void NodeExpandHandler(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)

 

{

SiteMenu = (RadTreeView)sender;

LastSelectedNode = e.Node;

 

 

// get the custom sql site map provider

 

 

SqlSiteMapProvider provider = ((SqlSiteMapProvider)SiteMap.Providers[

"MyPortalSiteMapProvider"]);

 

 

 

if (provider == null)

 

 

 

return;

 

 

 

// add a method to get chid nodes by Key

 

 

SiteMapNode siteNode = provider.FindSiteMapNodeFromKey(e.Node.Value);

 

if (siteNode == null)

 

 

 

return;

 

SiteMapNodeCollection childNodes = provider.GetChildNodes(siteNode);

 

 

if (childNodes.Count < 1)

 

 

 

return;

 

 

 

// NW: call FindSiteMapNodeFromKey() of the SiteMapProvider using

 

 

 

// the key obtained from the node that was clicked.

 

 

 

// The node that was clicked becomes the new parent of the children

 

 

 

// to be added to it from the database.

 

 

 

//

 

 

 

foreach (SiteMapNode child in childNodes)

 

{

 

 

// NW: The children are created based on the information obtained from

 

 

 

// the database.

 

 

 

//

 

 

 

// create a new node

 

 

RadTreeNode rtn =

new RadTreeNode()

 

{

Value = child.Key, Text = child.Title,

ExpandMode = TreeNodeExpandMode.ServerSide,

 

//NW: This is overiden below.

 

 

NavigateUrl = child.Url, LongDesc = child.Description

};

 

// with the same expand mode as the node currently expanding

 

 

rtn.ExpandMode = e.Node.ExpandMode;

 

// add the new node to the node that is expanding

 

 

e.Node.Nodes.Add(rtn);

}

 

// now that the nodes are added, change the current node's expand mode to client-side

 

 

e.Node.ExpandMode = TreeNodeExpandMode.ClientSide;

 

// signal that the node is now expanded

 

 

e.Node.Expanded =

true;

 

}

NOTE:

 

 // we are not using the following code

 

 

protected void NodeClickHandler(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)

 

{

SiteMenu = (RadTreeView)sender;

LastSelectedNode = e.Node;

}

}

}

once again please help......we have a critical situation here that we are so close to fixing, and this is holding us back.

ps...tried attaching a zip!

regards
Shaun Pitt
Chisholm Institute - Australia

 

Nikolay Tsenkov
Telerik team
 answered on 28 Jun 2010
1 answer
119 views
Hi, i'm usign a RadComboBox (RadControls_for_ASP.NET_AJAX_2010_1_519_dev) with EnableVitualScrolling and ShowMoreResultsBox as in your example

http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx

The loading on demand works, but the ShowMoreResultsBox is graphically different from your example (I have only the down arrow without the items numbers) and using the keyboard it don't loads the next page when the cursors reach the end of the current page, as in your example.
I must use the mouse clicking on the ShowMoreResultsBox arrow.
Attached as it appears to me.
Why this difference? I can't find any missing settings.

Thanks
  Alessandro Strazzari
Kalina
Telerik team
 answered on 28 Jun 2010
2 answers
178 views
I am creating several buttons in the the commandItemTemplate, I am using these to export tp csv plus many other things (I could use the commandItemSettings but dont want to). The problem I am having is that I cannot find the buttons in the code behind.  My code is as follows.

 
 
<telerik:RadAjaxLoadingPanel runat="server" ID="progressLoader" MinDisplayTime="1500" InitialDelayTime="1000" Skin="Default"></telerik:RadAjaxLoadingPanel> 
<telerik:RadAjaxPanel runat="server" ID="rap_panel1" LoadingPanelID="progressLoader">  
        <telerik:RadGrid ID="RadGrid1"    
                         runat="server"   
                         GridLines="Vertical" 
                         ShowGroupPanel="True"   
                         PageSize="18"   
                         AllowSorting="true"   
                         AllowPaging="true"   
                         AutoGenerateColumns="false"   
                         EnableHeaderContextMenu="true" 
                         Skin="Default">              
            <ExportSettings> 
                <Pdf FontType="Subset" PaperSize="A4" /> 
                <Excel Format="Html" /> 
                <Csv ColumnDelimiter="Comma" RowDelimiter="NewLine" /> 
            </ExportSettings> 
            <MasterTableView DataKeyNames="ROWCLICK" GroupLoadMode="Client" CommandItemDisplay="Top">  
                <PagerStyle  Mode="NextPrevNumericAndAdvanced" /> 
 
               <CommandItemTemplate> 
 
                      <asp:LinkButton ID="btn_save" runat="server" CommandName="saveGrid" ><asp:Image runat="server" ID="img_save" ImageUrl="~/_resources/images/icons/tick.png"/></asp:LinkButton> 
                        <asp:LinkButton ID="btn_excel" runat="server" CommandName="excel" ><asp:Image runat="server" ID="Image1" ImageUrl="~/_resources/images/icons/xls_grey.gif"/></asp:LinkButton> 
                        <asp:LinkButton ID="btn_pdf" runat="server" CommandName="pdf" ><asp:Image runat="server" ID="Image2" ImageUrl="~/_resources/images/icons/pdf.gif"/></asp:LinkButton> 
                          
                      
                </CommandItemTemplate> 
            </MasterTableView> 
            <ClientSettings ReorderColumnsOnClient="True"   
                            AllowDragToGroup="True"   
                            AllowColumnsReorder="True"   
                            EnablePostBackOnRowClick="true"   
                            AllowGroupExpandCollapse="true">  
                <Resizing AllowRowResize="True"   
                          AllowColumnResize="True"   
                          EnableRealTimeResize="True" 
                          ResizeGridOnColumnResize="False">  
                </Resizing> 
            </ClientSettings> 
        </telerik:RadGrid> 
</telerik:RadAjaxPanel> 


    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated  
 
        Dim item As GridCommandItem = TryCast(e.Item, GridCommandItem)  
        If item IsNot Nothing Then 
            Dim btn As Button = TryCast(item.FindControl("btn_excel"), Button)  
 
        End If 
 
    End Sub 

Any help would be much appreciated.
mabs
Top achievements
Rank 1
 answered on 28 Jun 2010
1 answer
211 views
I'm trying to programatically allow a user to select a row in a RadGrid, then disable the grid completely and edit information (outside of the Grid), then rebind it and allow the user to be able to select, sort and filter data.  However, when I set the radgrid.Enabled to false, it still allows me to select rows and interact with the grid.  It doesn't matter if I am doing it through code, or directly in the properties for the grid.  I've even tried to put the grid in a panel, and disable the panel, but the grid still functions. 

The only way that I've found that I can disable the ability to select a row (the only thing that I really need to do), is to set the RadGrid.ClientSettings.Selecting.AllowRowSelect to false while I'm doing the editing, then set it back to true.  However, I can still sort on the table.

Also, the version that I'm using is 2009.2.701.35 if that makes a difference.  I looked through the forums and did not see any mention of this.

Thanks.
Shinu
Top achievements
Rank 2
 answered on 28 Jun 2010
3 answers
441 views
I have the following setting

.RadForm_CustomVista table.rfdRoundedWrapper:hover .rfdRoundedOuter 
{ 
    background-color: #c5daed !important; 
} 
 
This colors the side of rounded input controls. My problem is that I'd like to have it not apply to disabled textboxes, but I can't seem to figure out how to do that.

Another problem is that if I disable the textboxes in the codebehind, the side borders will disappear entirely.

Thanks

EDIT: On further examination, I've discovered that the missing side borders happens with a RadMultipage with RenderSelectedPageOnly="false" for disabled textboxes if they are on a tab that is not currently selected when a postback occurs.
Bozhidar
Telerik team
 answered on 28 Jun 2010
1 answer
91 views
I have a sitemap that I would like to layout with 3 columns, first row should have 2 nodes, second row with one long node, and third column with 2 nodes.  Does the sitemap control not respect the height property and push nodes to other columns? 

See my attached screenshot for example.
Genady Sergeev
Telerik team
 answered on 28 Jun 2010
0 answers
119 views
I am using server side code to populate the combobox. and enabled "EnableLoadOnDemand"
The combobox doesnt seem working correctly. When the page first opens, click into the combobox nothing hapens and it is not populated. When I type in something or delete what i typed in then it populates. I tried to change the code to as simple as assigning a datatable to the combobox datasource still no luck..

any idea?

 

sf
Top achievements
Rank 1
 asked on 28 Jun 2010
1 answer
89 views
Hello,

I have a problem. I need to show a Pie chart populated with databound, but I need to show informations like in this example:

Results
Cities | Population
City1 |50
City2 |10
City3 |40

In the chart Legend:

.City1
.City2
.City3

In each pie (label)
.50
.10
.40

It must be simple, but I dont know how to configure the control to show this. I always have the same values in legend and label.

Thanks

Marcelo



City1 |1000

Ves
Telerik team
 answered on 28 Jun 2010
1 answer
122 views
Hi all,

I have EditItemTemplate for all columns. Whenever I put an GridEditCommandColumn on the grid, it causes the controls to be showed in a column view not in a row view. How can I force it to show them in row layout view?

UPDATE:
Following page (second Grid) is showing editing controls as column too:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/commanditem/defaultcs.aspx

Thanks in Advance
Afshar Mohebbi
Top achievements
Rank 1
 answered on 28 Jun 2010
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?