Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
445 views
When attached to my w3wp.exe process for my DNN 7 website, I receive a flood of InsecureExternalStyleSheetException's

Exception Data:
Telerik.Web.UI.InsecureExternalStyleSheetException occurred
Message=The style sheet '/js/dnn.js' is not located in any of the 'Style Sheet' folders designated in the web.config.
Source=Telerik.Web.UI
StackTrace:
at Telerik.Web.UI.ExternalScriptHelper.ResolveSecurePath(String scriptRelativePath)

Looking this up, it's saying that I need any folder that has a css file to be in a list of folders described by the appSettings key of Telerik.Web.UI.StyleSheetFolders.

Here are the two related settings:

<add key="Telerik.Web.UI.ScriptFolders" value="~/Scripts/;" /><!--~/js/;-->
    <add key="Telerik.Web.UI.StyleSheetFolders" value="~/admin/ControlPanel/;~/DesktopModules/Admin/Authentication/;~/DesktopModules/Brick/User Dashboard/;~/DesktopModules/DNNCentric-AJAXFAQ/;~/DesktopModules/DNNCentric-AJAXFAQ/themes/skindefault/;~/DesktopModules/EasyDNNRotator/Controls/ChameleonRotator/static/common/;~/DesktopModules/EasyDNNRotator/Controls/ChameleonRotator/static/themes/callisto/;~/DesktopModules/EasyDNNRotator/flowplayer/skin/;~/DesktopModules/TabsPro/templates/blitzer-simple/;~/Portals/_default/;~/Portals/_default/Containers/Brick/;~/Portals/_default/Containers/Gravity/;~/Portals/_default/Containers/TabsPro/;~/Portals/_default/Skins/_default/WebControlSkin/Default/;~/Portals/_default/Skins/Brick/;~/Portals/_default/Skins/Brick/bootstrap/css/;~/Portals/_default/Skins/Brick/css/;~/Portals/_default/Skins/Brick/js/colorpicker/css/;~/Portals/0/;~/StaticContent/kendo/styles/;~/js/;" />


I made sure that any folder on any page that loads a css file is included in that list (the second one).

When I try to add /js to ScriptFolders, it causes 404's on 2 of the 3 WebResource.axd calls for any page that is generated by DNN. One of those seems to be rather important as it causes Sys to be undefined and kills most of the other javascript on the page.

Bozhidar
Telerik team
 answered on 03 Nov 2015
1 answer
222 views

Hi All,

 

How can I use scriptmanager on Masterpage and RadScriptManager on Content page in asp.net.

Kindly help me.

 Thanks.

Bozhidar
Telerik team
 answered on 03 Nov 2015
1 answer
316 views

Hi I have a RadTabStrip which has several RadPageView. And I am creating dynamic tabs and pageview for the tabs. Each Pageview has a user control.Within the user control i am rendering a form which is also created dynamically.  My problem is that when an event occurs such as button click (edit/save) on one user control, it again loads all the User controls, since the tabs and pageviews are created dynamically i have to recreate all tabs and pageview again. So, all the user controls loads again.

I just want only one user control to do post back, such as save, while keeping other tabs and pageview intact without reloading it.

Is that possible?​.

 

Thanks.

Ivan Danchev
Telerik team
 answered on 03 Nov 2015
5 answers
299 views
Hi,
   How to add an item with an checkbox to RadComboBox using javascript(client side).
Please let me know if you need more details.

Any suggestions pls
Eyup
Telerik team
 answered on 03 Nov 2015
1 answer
177 views
Is it somehow possible to programmatically change for example PageSizeText or the list of PageSizes for the RadDataPager?
 
Eyup
Telerik team
 answered on 03 Nov 2015
1 answer
261 views

Hi,

 We have a custom FileBrowserContentProvider set up to use Azure blob storage.  It's coded to set the Azure storage container name when it is instantiated.  What happens is when UserA opens the form with the RadEditor, it is initialized with PathA and when UserA then opens ImageManager they can work with their files.  When UserB opens the form, it is initialized with PathB and UserB opens ImageManager and they can work with their files.  But then UserA is still on the form, and re-opens ImageManager and they see UserB's files.  

 

Is there a way to implement this so that it is safe for each user, with their different paths, to use?  Preferrably without Session variables, because it's also possible for the same user to have multiple paths on different pages opened at the same time.   Thanks

 

public class ExtendedFileProvider : FileBrowserContentProvider
   {
       private string EmptyFileName = "deleteme.$$$";
       private PathPermissions fullPermissions = PathPermissions.Upload | PathPermissions.Read | PathPermissions.Delete;
       private static string _ContainerName;
       Dictionary<string, List<FileItem>> TelerikAzure_Files = new Dictionary<string, List<FileItem>>();
       Dictionary<string, List<string>> TelerikAzure_Directories = new Dictionary<string, List<string>>();
 
       public ExtendedFileProvider(string ContainerName)
       {
           _ContainerName = ContainerName;
       }
 
       //constructor must be present when overriding a base content provider class
       //you can leave it empty
       public ExtendedFileProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
           : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)
       {
           LoadContainerItems();
       }
 
 
       private string Root
       {
           get
           {
               return GetAzureClient().BaseUri.ToString().TrimEnd('/') + "/" + GetTelerikContainer().Name;
           }
       }
 
 
       private void EnsureContainerExists(CloudBlobContainer container)
       {
           container.CreateIfNotExist();
           dynamic permissions = container.GetPermissions();
           permissions.PublicAccess = BlobContainerPublicAccessType.Container;
           container.SetPermissions(permissions);
       }
 
 
       /// <summary>
       /// Loads the files and folders structure and caches the result
       /// </summary>
       /// <remarks></remarks>
       private void LoadContainerItems()
       {
 
           try
           {
 
               Dictionary<string, List<FileItem>> wFiles = new Dictionary<string, List<FileItem>>();
               Dictionary<string, List<string>> wDirectories = new Dictionary<string, List<string>>();
 
               EnsureContainerExists(GetTelerikContainer());
 
               wFiles.Clear();
               wDirectories.Clear();
               BlobRequestOptions options = new BlobRequestOptions();
               options.BlobListingDetails = BlobListingDetails.All;
               options.UseFlatBlobListing = true;
 
 
               foreach (IListBlobItem blobItem in GetAzureClient().ListBlobsWithPrefix(GetTelerikContainer().Name + "/", options))
               {
                   dynamic blob = GetTelerikContainer().GetBlobReference(blobItem.Uri.ToString());
                   string wFileName = blob.Uri.ToString().Replace(Root, "").TrimStart('/');
                   string wDirectoryName = "/" + wFileName.Replace(System.IO.Path.GetFileName(wFileName), "").TrimEnd('/');
                   blob.FetchAttributes();
 
                   FileItem wFileItem = new FileItem(System.IO.Path.GetFileName(wFileName), System.IO.Path.GetExtension(wFileName), blob.Attributes.Properties.Length, wFileName, blobItem.Uri.ToString(), "", fullPermissions);
 
                   InternalOperations.CreateErrorLogFIle(wFileItem.Name);
 
                   InternalOperations.CreateErrorLogFIle(wFileItem.ToString());
 
                   if (!wFiles.ContainsKey(wDirectoryName))
                   {
                       string Path = "";
                       dynamic ParentFolder = "";
                       foreach (string wDirectory in wDirectoryName.Split('/'))
                       {
                           Path = Path.TrimEnd('/') + "/" + wDirectory;
                           if (!wDirectories.ContainsKey(Path))
                           {
                               wDirectories.Add(Path, new List<string>());
                               if (ParentFolder.Length > 0)
                               {
                                   wDirectories[ParentFolder].Add(Path);
                               }
                           }
                           ParentFolder = Path;
                       }
                       wFiles.Add(wDirectoryName, new List<FileItem>());
                   }
                   if (!(wFileItem.Name == EmptyFileName))
                   {
                       InternalOperations.CreateErrorLogFIle("3");
                       wFiles[wDirectoryName].Add(wFileItem);
                   }
               }
 
               TelerikAzure_Files = wFiles;
               TelerikAzure_Directories = wDirectories;
 
           }
           catch (Exception ex)
           {
               InternalOperations.CreateErrorLogFIle(ex.Message);
           }
       }
 
 
 
       // ''' <summary>
       //''' Gets the Azure storage name through a key in web.config AppSettings section. E.g. <add key="DataConnectionString" value="UseDevelopmentStorage=true"/>
       //''' </summary>
       //''' <returns></returns>
       //''' <remarks></remarks>
       private CloudBlobClient GetAzureClient()
       {
           CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureStorage"].ConnectionString);
           return storageAccount.CreateCloudBlobClient();
       }
 
 
       //     ''' <summary>
       //''' Gets the container name through a key in web.config AppSettings section. E.g. <add key="TelerikContainer" value="body"/>
       //''' </summary>
       //''' <returns></returns>
       //''' <remarks></remarks>
       private CloudBlobContainer GetTelerikContainer()
       {
           var client = GetAzureClient();
           //return client.GetContainerReference(ConfigurationManager.AppSettings["TelerikContainer"].ToString());
 
           return client.GetContainerReference(_ContainerName);
       }
 
       public override string CreateDirectory(string path, string name)
       {
           string Filename = (path + name).TrimStart('/');
           Microsoft.WindowsAzure.StorageClient.CloudBlob blob = GetTelerikContainer().GetBlobReference(Filename + "/" + EmptyFileName);
           blob.UploadText(".");
 
           return string.Empty;
       }
 
 
       public override string DeleteDirectory(string path)
       {
 
 
           Microsoft.WindowsAzure.StorageClient.BlobRequestOptions options = new Microsoft.WindowsAzure.StorageClient.BlobRequestOptions();
 
           options.BlobListingDetails = BlobListingDetails.All;
           options.UseFlatBlobListing = true;
 
           foreach (IListBlobItem blobItem in GetAzureClient().ListBlobsWithPrefix(GetTelerikContainer().Name + path, options))
           {
               string wFileName = blobItem.Uri.ToString().Replace(Root, "");
               DeleteFile(wFileName);
           }
 
 
           return string.Empty;
       }
 
       public override string DeleteFile(string path)
       {
           CloudBlob blob = GetTelerikContainer().GetBlobReference(path.TrimStart('/'));
           blob.DeleteIfExists();
           //if (!BatchProcess)
           //{
           //    PurgeCacheItems("TelerikAzure_");
           //}
 
           return string.Empty;
       }
 
 
       public override System.IO.Stream GetFile(string url)
       {
           url = url.TrimStart('/');
           var blob = GetTelerikContainer().GetBlobReference(url);
           try
           {
               byte[] content = blob.DownloadByteArray();
 
               if (content.Length != 0)
               {
                   return new System.IO.MemoryStream(content);
 
               }
               return null;
           }
           catch (Exception Ex)
           {
               return null;
           }
       }
 
       public override string GetFileName(string url)
       {
           return System.IO.Path.GetFileName(url);
       }
 
       public override string GetPath(string url)
       {
           return url.Replace(GetFileName(url), "");
       }
 
       public override DirectoryItem ResolveDirectory(string path)
       {
           DirectoryItem[] directories = GetChildDirectories(path);
           string wDirectoryName = System.IO.Path.GetFileName(path);
 
           return new DirectoryItem(wDirectoryName, path, path, String.Empty, fullPermissions, GetChildFiles(path), directories);
       }
 
       public override DirectoryItem ResolveRootDirectoryAsTree(string path)
       {
           string wDirectoryName = System.IO.Path.GetFileName(path);
 
           DirectoryItem returnValue = new DirectoryItem(wDirectoryName, path, path, string.Empty, fullPermissions, GetChildFiles(path), GetChildDirectories(path));
           return returnValue;
       }
 
       public override string StoreBitmap(System.Drawing.Bitmap bitmap, string url, System.Drawing.Imaging.ImageFormat format)
       {
           dynamic blob = GetTelerikContainer().GetBlobReference(url);
           System.IO.MemoryStream imgStream = new System.IO.MemoryStream();
           if (format.Equals(System.Drawing.Imaging.ImageFormat.Jpeg))
           {
               blob.Properties.ContentType = "image/jpeg";
           }
           else if (format.Equals(System.Drawing.Imaging.ImageFormat.Gif))
           {
               blob.Properties.ContentType = "image/gif";
           }
           else if (format.Equals(System.Drawing.Imaging.ImageFormat.Png))
           {
               blob.Properties.ContentType = "image/png";
           }
           else if (format.Equals(System.Drawing.Imaging.ImageFormat.Icon))
           {
               blob.Properties.ContentType = "image/icon";
           }
           else if (format.Equals(System.Drawing.Imaging.ImageFormat.Tiff))
           {
               blob.Properties.ContentType = "image/tiff";
           }
           else if (format.Equals(System.Drawing.Imaging.ImageFormat.Wmf))
           {
               blob.Properties.ContentType = "image/wmf";
           }
           else if (format.Equals(System.Drawing.Imaging.ImageFormat.Emf))
           {
               blob.Properties.ContentType = "image/emf";
           }
           else if (format.Equals(System.Drawing.Imaging.ImageFormat.Exif))
           {
               blob.Properties.ContentType = "image/exif";
           }
           else if (format.Equals(System.Drawing.Imaging.ImageFormat.Bmp) | format.Equals(System.Drawing.Imaging.ImageFormat.MemoryBmp))
           {
               blob.Properties.ContentType = "image/bmp";
           }
           bitmap.Save(imgStream, format);
 
           imgStream.Position = 0;
           blob.UploadFromStream(imgStream);
 
           imgStream.Close();
           //PurgeCacheItems("TelerikAzure_");
 
           return string.Empty;
       }
 
       public override string StoreFile(Telerik.Web.UI.UploadedFile file, string path, string name, params string[] arguments)
       {
           string Filename = (path + name).TrimStart('/');
 
           dynamic blob = GetTelerikContainer().GetBlobReference(Filename);
           blob.Properties.ContentType = file.ContentType;
           blob.UploadFromStream(file.InputStream);
           //PurgeCacheItems("TelerikAzure_");
 
           return string.Empty;
       }
 
 
       private FileItem[] GetChildFiles(string path)
       {
           Dictionary<string, List<FileItem>> wFiles = TelerikAzure_Files;
 
           try
           {
               List<FileItem> wReturn = new List<FileItem>();
               foreach (FileItem wFile in wFiles[path])
               {
                   if (IsExtensionAllowed(wFile.Extension))
                   {
                       wReturn.Add(wFile);
                   }
               }
               return wReturn.ToArray();
           }
 
           catch (Exception ex)
           {
               InternalOperations.CreateErrorLogFIle("=>>5");
               return new FileItem[] { };
           }
       }
 
 
       private bool IsExtensionAllowed(string extension)
       {
           return Array.IndexOf(SearchPatterns, "*.*") >= 0 || Array.IndexOf(SearchPatterns, "*" + extension.ToLower()) >= 0;
       }
 
       private DirectoryItem[] GetChildDirectories(string path)
       {
           Dictionary<string, List<string>> wDirectories = TelerikAzure_Directories;
 
           List<DirectoryItem> directories = new List<Telerik.Web.UI.Widgets.DirectoryItem>();
 
           try
           {
               foreach (string wDirectory in wDirectories[path])
               {
                   string wDirectoryName = System.IO.Path.GetFileName(wDirectory);
                   directories.Add(new DirectoryItem(wDirectoryName, wDirectory, wDirectory, String.Empty, fullPermissions, GetChildFiles(wDirectory), GetChildDirectories(wDirectory)));
               }
 
               return directories.ToArray();
           }
 
           catch (Exception ex)
           {
               return new DirectoryItem[] { };
           }
       }
 
       public override bool CanCreateDirectory
       {
           get { return true; }
       }
 
       //For Older Telerik Version Delete keyword "Overrides"
       public override bool CheckWritePermissions(string folderPath)
       {
           return true;
       }
 
       public override string MoveFile(string path, string newPath)
       {
           string Filename = path.TrimStart('/');
           dynamic blobSource = GetTelerikContainer().GetBlobReference(Filename);
           dynamic blobDestination = GetTelerikContainer().GetBlobReference(newPath.TrimStart('/'));
           try
           {
               blobDestination.CopyFromBlob(blobSource);
           }
           catch (Exception ex)
           {
           }
           blobSource.DeleteIfExists();
 
           return string.Empty;
       }
 
       public override string MoveDirectory(string path, string newPath)
       {
           newPath = newPath + "/";
           BlobRequestOptions options = new BlobRequestOptions();
           options.BlobListingDetails = BlobListingDetails.All;
           options.UseFlatBlobListing = true;
           foreach (IListBlobItem blobItem in GetAzureClient().ListBlobsWithPrefix(GetTelerikContainer().Name + path, options))
           {
               string wFileName = blobItem.Uri.ToString().Replace(Root, "");
               string wNewFileName = wFileName.Replace(path, newPath);
               MoveFile(wFileName, wNewFileName);
           }
 
           return string.Empty;
       }
   }

Ianko
Telerik team
 answered on 03 Nov 2015
3 answers
246 views

Hi,

 

Is there a way to implement line spacing in the RadEditor tools while using . file?  The docs show how to do it with markup but not with the tools file.  I can add it as a button in the tools file, but it shows it is not implemented and I don't know how to add the options to it.  Thanks

Ianko
Telerik team
 answered on 03 Nov 2015
17 answers
1.1K+ views
I have a grid with items that are only read in code, both on client and server side and not all of them are editable by the user.

Here is part of grid setup

 

<telerik:RadGrid ID="RadGridM" runat="server" DataSourceID="DatabaseItem" OnPageIndexChanged="PageChange"

 

 

AutoGenerateColumns="False" GridLines="None" AllowMultiRowSelection="true" EnableViewState="false"

 

 

Skin="Office2007" AllowPaging="True" PageSize="25"

 

 

AllowFilteringByColumn="True" OnPreRender="RadGridM_PreRender" >

 

 

<Columns>

 

<telerik:GridTemplateColumn DataField="QtyOrd"

 

 

HeaderText="Qty Ord" ReadOnly="False" SortExpression="QtyOrd" UniqueName="QtyOrd" Visible="true" AllowFiltering="false" >

 

 

<ItemTemplate>

 

 

<asp:TextBox ID="txtQtyOrdI" runat="server" Text='<%# Bind( "QtyOrd") %>'

 

 

Visible="true"></asp:TextBox>

 

<%

# DataBinder.Eval(Container.DataItem, "QtyOrd")%>

 

 

</ItemTemplate>

 

 

<EditItemTemplate>

 

 

<asp:TextBox ID="txtQtyOrd" runat="server" Text='<%# Bind( "QtyOrd") %>' Width="10pt"></asp:TextBox>
<asp:TableCell><asp:CustomValidator ID="Validate_Qty" runat="server" ControlToValidate="txtQtyOrd" ErrorMessage="Amount must be greater than 0." OnServerValidate="CustomValidator_Qty"></asp:CustomValidator>

 

 

</EditItemTemplate>

 

 

</telerik:GridTemplateColumn >

 

 

<telerik:GridBoundColumn DataField="ItemNumber" HeaderText="Item Number" ReadOnly="True" SortExpression="ItemNumber" UniqueName="ItemNumber" Visible="true">

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

</Columns>

 

 

</mastertableview>

 

 

 

 

 

</telerik:RadGrid>

 

 

<asp:Button ID="Selection" runat="server" Text="Add Selected" onclick="Selection_Click" />

 

 

 


On the server side when the user presses the Selection button I need to read all the values of each line on the RadGrid.
I am able to get the items with a GridTemplateColumn using this code

 

 

foreach (GridDataItem item1 in RadGridM.Items)

 

{

 

 

GridDataItem item = (GridDataItem)item1;

 

 

TextBox QtyVal = item.FindControl("txtQtyOrdI") as TextBox;

 

 

}

This does not work for the GridTemplateColumn, ItemNumber

I have tried getting the DataRowView, and adding the Item Template to the GridTemplateColumn, but the value or item comes back null.

I have also tried item["ItemNumber"] and item["ItemNumber"].Control[0] 

If I have a grid that does not allow any editing, but diplays values I need to process server side, and all items are in the form, below, how to a loop through each row on the server side and read the text from every column?

 

 

<telerik:GridBoundColumn DataField="testvalue" HeaderText="testvalue"

 

 

SortExpression="testvalue" UniqueName="testvalue" Visible="true" ReadOnly="True">

 

 

</telerik:GridBoundColumn>

I have also tried the things in this post, and they only work on an Item Template.

 

 

http://www.telerik.com/community/forums/aspnet-ajax/grid/itemdatabound-on-gridtemplatecolumn.aspx

Thanks
Sue

 

 

 

 

Eyup
Telerik team
 answered on 03 Nov 2015
4 answers
199 views

Hi

 We are using RadEditors with Image Managers that use a custom file dialog via FileBrowserContentProvider. The reason is that our images need to go through an approval process before they can be added to the content. Everything is working except when a new image is added.

When you click on the image manager icon the first time, it fires the ResolveDirectory() override in our code and all is good and displayed correctly. Now the users adds a new image that goes through our approval process (on another control on the page, not part of the radeditor). Now the user clicks on the Image Manager again, but the ResolveDirectory() override does not fire again (I put a break in my code to test). And thus the user does not see the new image and has to click the refresh button. Although this is minor, it is generating a lot of support calls from users.

 Is there a javascript method we can use to force the Image Manager and similarly the Document Manager to refresh?

 Thanks

Ianko
Telerik team
 answered on 03 Nov 2015
1 answer
106 views

Hi guys,
this is the first time that I use the RadScheduler object, in the example there is the case with TimeLineView and Grouping, but if I select "Date, Room" the rooms appear divided into columns, and the dates divided into rows, is possibile to have dates rendered one for each column and rooms one for each row?

I hope I have explained it well, and sorry for my poor english

Plamen
Telerik team
 answered on 03 Nov 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?