Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
285 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
249 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
103 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
224 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
189 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.0K+ 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
165 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
82 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
5 answers
149 views
I am trying to present a RadWindow after clicking on a Label within my main application page.

If I place no content in the window I have at least been able to get it to appear,
but as soon as I place any content in the ContentTemplate, or maybe even just the act
of putting in an empty ContentTemplate block the Window no longer appears.

I have created a non Master page and succesfully displayed a RadWindow 
containing a Grid which I hooked up to a dummy datasource.

The bad news there is that as soon as I react with the pagination to go to page 2
the 'modal' Window disappears, again not the behavior I am looking for TIA 
Diego
Top achievements
Rank 1
 answered on 02 Nov 2015
2 answers
131 views

 Hello,

I am having an issue where I have set a schedule to have no end date, but it does not give us enough occurrences. It gives me only 98. When I look inside the ReccurenceRule object, it looks like it should be giving me more than 98 occurrences. My schedule does have one exception date. I have attached screenshots of my parse rule, list of given occurrences, the pattern, and the range allowed. Is this a bug in Telerik or do I have something set incorrectly?

My parse rule:

{DTSTART:20140109T170000Z
DTEND:20140109T200000Z
RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=2;BYDAY=TH
EXDATE:20150312T170000Z
}

Stephen
Top achievements
Rank 1
 answered on 02 Nov 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?