Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
347 views
I used an example I found in these forums to show the # of files in a directory beside the name of the directory. The example seems to work fine but once I tried to change it around to suit my exact needs, I found some issues.

I wanted the following changes
1. All directories to show # of files within it including subdirectories (no problem, easily done)
2. Setting the paths in the code behind rather than within the html
3. Any change to the files (i.e. upload new file, delete file, move file) will automatically refresh the treeview

Here are the problems I experienced:
- if you set the path in the code behind, the refresh button will not update the # of files in the treeview (but will work if path are set within the html code)
- I tried to use RadFileExplorer1.TreeView.Nodes.Clear(); in the page_load to force a refresh of the treeview (which works) but this had an adverse side effect. After a file delete or file move, the changed file still appears in the grid as if the file wasn't deleted or moved until I pressed the refresh button.

Help?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using Telerik.Web.UI.Widgets;
using System.IO;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //RadFileExplorer1.TreeView.Nodes.Clear();
 
        RadFileExplorer1.Configuration.ViewPaths = new string[] {@"~/Thumbs/"};
        RadFileExplorer1.Configuration.UploadPaths = new string[] { @"~/Thumbs/" };
        RadFileExplorer1.Configuration.DeletePaths = new string[] { @"~/Thumbs/" };
 
        RadFileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomProvider).AssemblyQualifiedName;
    }
 
    public class CustomProvider : FileSystemContentProvider
    {
        public CustomProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
            : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)
        { }
 
 
        public override DirectoryItem ResolveRootDirectoryAsTree(string path)
        {
            DirectoryItem originalDir = base.ResolveRootDirectoryAsTree(path);
            string physicalPath = Context.Server.MapPath(path);
 
            List<DirectoryItem> childDirItems = new List<DirectoryItem>();
            foreach (DirectoryItem currentDir in originalDir.Directories)
            {
                string physicalPathChildFile = Context.Server.MapPath(currentDir.FullPath);
                DirectoryItem childDirItem = new DirectoryItem(currentDir.Name + "(" + Directory.GetFiles(physicalPathChildFile, "*.*", SearchOption.AllDirectories).Length + ")",
                                                                currentDir.Location,
                                                                currentDir.FullPath,
                                                                currentDir.Tag,
                                                                currentDir.Permissions,
                                                                currentDir.Files,
                                                                currentDir.Directories
                                                                  );
                childDirItems.Add(childDirItem);
            }
 
 
            DirectoryItem dirItem = new DirectoryItem(originalDir.Name + "(" + Directory.GetFiles(physicalPath, "*.*", SearchOption.AllDirectories).Length + ")",
                                                      originalDir.Location,
                                                      originalDir.FullPath,
                                                      originalDir.Tag,
                                                      originalDir.Permissions,
                                                      originalDir.Files,
                                                     childDirItems.ToArray()
                                                      );
            return dirItem;
        }
 
        public override DirectoryItem ResolveDirectory(string path)
        {
            DirectoryItem originalDir = base.ResolveDirectory(path);
            string physicalPath = Context.Server.MapPath(path);
 
            DirectoryItem dirItem = new DirectoryItem(originalDir.Name + "(" + Directory.GetFiles(physicalPath, "*.*", SearchOption.AllDirectories).Length + ")",
                                                      originalDir.Location,
                                                      originalDir.FullPath,
                                                      originalDir.Tag,
                                                      originalDir.Permissions,
                                                      originalDir.Files,
                                                      originalDir.Directories
                                                      );
            return dirItem;
        }
    }
}

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="Telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="Form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" Height="300px" Width="804px"
        Skin="Forest">
        <Configuration SearchPatterns="*.*"></Configuration>
    </telerik:RadFileExplorer>
    </form>
</body>
</html>
Ed
Top achievements
Rank 1
 answered on 12 Apr 2011
2 answers
165 views
I am building a row button that'll make a duplicate of the row the user clicked.  I want it to then let the user edit the row.  In my particular case I am using the built in popup form to edit the row.

So I have a GridButtonColumn, I catch it in the OnItemCommand event - but how do I initiate the edit on the new row?  Or, bring up the New Row form, loaded with the data from the row I'm copying?

Ron Michael Zettlemoyer
Top achievements
Rank 1
 answered on 12 Apr 2011
1 answer
310 views
Hello,

I have a RadGrid with a NestedViewTemplate inside it. I wish to expand the first row of the NestedViewTemplate when the page first loads.

I have been unable to acheive this so far, can anyone suggest how best to acheive this?

Thanks,

Ken
Jerry T.
Top achievements
Rank 1
 answered on 12 Apr 2011
2 answers
134 views
I have a RadWindow acting as a wizard in an application, and one of the pages contains a RadUpload. This has worked fine on both my development and production environment. Recently I upgraded the project from a 2009 version (I forget which one) of Telerik RadControls for ASP.NET Ajax to Q1 2011. This tests fine in development. However in the production environment, after modifying the Web Application to run ASP.NET 4 (It was 2), the RadUpload items began acting strangely. I have these in a few places and usually, they include the input area and the Select button. I am finding that they are invisible on the production server, where they are visible on the development server. I am running IIS 6 on production and IIS 7 on development. I also added a dummy RadUpload with all controls visible, and when I do this all I see are Add and Delete buttons. I also notice that this only occurs in the RadWindow page, where some other pages that contain RadUpload controls behave normally. 

Is there something I need to do when I upgrade the production to a new version of Telerik RadControls for ASP.NET Ajax? I copied in the new Telerik.Web.UI.dll, Telerik.Web.UI.Dll.Refresh and Telerik.Web.UI.XML files. Also I sync'ed up the web.config files such that the production and development versions only differ in the App Settings sections.

Thanks, Steve
neebs
Top achievements
Rank 2
 answered on 12 Apr 2011
1 answer
299 views
var grid = $find(gridID);          
 var masterTable = grid.get_masterTableView();
            var dataItems = masterTable.get_dataItems();
            var row = dataItems[itemIndex].get_element();
            masterTable.set_currentPageIndex(page);
            row.focus();
What I am trying to do is: i have a textbox with a number and when I mouse over on it, I pass the number to the parameters of "page" and "itemIndex", I want the grid show on that page and also focus on the row of that number. I can see the grid is refreshed on mouseover but the current page stay unchanged and the row focus doesn't work, if I change to masterTable.selectItem(row), it works ONLY when the current page is set to the one contains that row. Did I miss anything?

Thank you!
Vasil
Telerik team
 answered on 12 Apr 2011
4 answers
129 views
I have a page which includes both a master and details panel scenario and i want to update the page title when i hit the detail sub routine.

The code to this is working but as I am using RadAjaxPanel the head seciton of the page is not being updated.  I have tried EnablePageHeadUpdate="true" but does not make difference, am i missing something?

Of course as soon as I remove the RadAjaxPanel everything works just fine but dont want to lose my slick looking telerik stuff!

Cheers,

S
Maria Ilieva
Telerik team
 answered on 12 Apr 2011
1 answer
166 views
I have a RadEditor placed on a content page. When I run the web application locally (ASP.NET 3.5), the RadEditor shows up fine. When I deploy the web application to our production server, the editor doesn't show up, instead I get a series of bullet points that when hovered over show a tooltip of a toolbar.

I don't have the code with me right now, but can anyone suggest what I should check when I get back into work on Monday? Any pointers would be appreciated! I don't understand how it works fine locally (when I hit F5 in visual studio 2010), but when I deploy to the server it doesnt work. I can confirm that there are other applications on the server I am deploying to where the RadEditor works fine, just not in my web application project. Do I need to check any specific web.config settings?

Thanks
Dobromir
Telerik team
 answered on 12 Apr 2011
6 answers
305 views

I haven't used the slider control before, so hopfully I am missing something simple. First,
using the follwing code, the slider value are not displayed: 

<telerik:RadSlider id="RadSlider1" runat="server" Height="95px"

 

 

ItemType="Tick" Length="300" MaximumValue="5" MinimumValue="1" Value="3" Width="400px" Skin="Windows7" TrackPosition="TopLeft" >

 

 

 

</telerik:RadSlider>


Thanks for you help.

 

Niko
Telerik team
 answered on 12 Apr 2011
3 answers
241 views
Hello,

I have a page that pops up a RadWindow.  Then the page pops up a radconfirm.  I want the radconfirm to appear over the RadWindow, but it appears beneath the RadWindow.  Is there anyway to give the radconfirm a higher z-index?

Thanks.
Svetlina Anati
Telerik team
 answered on 12 Apr 2011
3 answers
271 views
Quick question - I've been trying to figure out how to horizontally align these columns of a simple instance of RadCalendar using 100% width and inside of a fixed width div.

Image: http://i.imgur.com/ksOfZ.jpg

Code:
<div style="width:400px; vertical-align:top;">
         
       <telerik:RadCalendar ID="RadCalendar1" runat="server" AutoPostBack="true" Width="100%"
               PresentationType="Preview" DayNameFormat="Short" ShowRowHeaders="false" ShowOtherMonthsDays="true"
               EnableMultiSelect="false" UseRowHeadersAsSelectors="false" UseColumnHeadersAsSelectors="false"
               OnDayRender="RadCalendar1_DayRender" OnPreRender="RadCalendar1_PreRender">
           <DayStyle HorizontalAlign="Center" />
           <SpecialDays>
               <telerik:RadCalendarDay Repeatable="Today" Date="" ItemStyle-CssClass="rcToday" />
           </SpecialDays>
       </telerik:RadCalendar>        
 </div>

Appreciate any help.  Thanks.

-- Mike
Tsvetina
Telerik team
 answered on 12 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
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
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?