Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
116 views
I have tried to use the CustomContentProvider to alter the parent directory name with no success

In one case when have the parent and then files under the parent.
In other cases we have a parent, that I want to customize the text and then sub folder that I want to display as they are in the file structure

When I try to use the CustomContentProvider I see no folders, in either case.
This is the code
​public class CustomContentProvider : FileSystemContentProvider
{
public CustomContentProvider(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 orgDir = base.ResolveRootDirectoryAsTree(path);


orgDir.Name = folderText;
return orgDir;
}
}


The parent folder is dynamic based on what was selected.
Frank
Top achievements
Rank 1
 answered on 09 Apr 2014
3 answers
184 views
Hi,
I have the following scenario:
  1. Upload a photo.
  2. If it is a landscape photo, then it should be cropped 16*9, other wise it is up to the user.
  3. Save the photo: I don't need the save dialog to shows up, before saving I need to validate the photo dimensions then save using server side code.
  4. After saving, reset crop setting to apply a new ratio.
  5. Crop the photo again, make sure it is more than 300px X 300px.
  6. Save: at this stage I need to resize the photo to become 300px X 300px then save it again using server side code

My questions are:
1. How to disable the controls on crop dialog like the dropdown menu and the textboxes.
2. How to fire save event on server side and access the modified photo.

<script type="text/javascript">
           function OnClientFilesUploaded(sender, args) {
               $find('<%=RadAjaxManager1.ClientID %>').ajaxRequest();
           }
 
           var width;
           var height;
           var heightAfterCrop;
           var imageVer1Saved=0; //Sould set to true after saving the 16X9 version
           function OnClientImageLoad(imageEditor) {
               imageEditor.zoomBestFit();
               waitForCommand(imageEditor, 'Crop', function (widget) {
                   width = imageEditor.getEditableImage().get_width();
                   height = imageEditor.getEditableImage().get_height();
                   if (width >= height) {
                       var ratio = 16 / 9;
                       heightAfterCrop = width / 16 * 9;
 
                       //Panoramic photos
                       if (height < heightAfterCrop) {
                           heightAfterCrop = height;
                           width = heightAfterCrop / 9 * 16;
                       }
                       //stop the aspect ratio constraint
                       //widget._constraintBtn.set_checked(false);
                       //widget._setCropBoxRatio(null);
                       //widget._sizeRatio = null;
 
                       widget._setCropBoxRatio(ratio);
                       widget._sizeRatio = ratio;
                       widget.set_width(width);
                       widget.set_height(heightAfterCrop);
                       widget._constraintBtn.set_enabled(false);
                       widget._swapBtn.set_enabled(false);
                       widget._updateCropBoxFromControls();
                        
                   }
               });
               imageEditor.executeCommand("Crop");
           }
 
           function waitForCommand(imageEditor, commandName, callback) {
               var timer = setInterval(function () {
                   var widget = imageEditor.get_currentToolWidget();
                   if (widget && widget.get_name() == commandName) {
                       clearInterval(timer);
                       callback(widget);
                   }
               }, 100);
           }
 
           function modifyCommand(imageEditor, args) {
               if (imageVer1Saved == 1)
               {
                   if (args.get_commandName() == "Crop") {
                       waitForCommand(imageEditor, args.get_commandName(), function (widget) {
                           width = 300;
                           height = 300;
                           var ratio = width / height;
 
                           //stop the aspect ratio constraint
                           //widget._constraintBtn.set_checked(false);
                           //widget._setCropBoxRatio(null);
                           //widget._sizeRatio = null;
 
                           widget._setCropBoxRatio(ratio);
                           widget._sizeRatio = ratio;
                           widget.set_width(width);
                           widget.set_height(height);
                           widget._constraintBtn.set_enabled(false);
                           widget._updateCropBoxFromControls();
                       });
                   }
               }
           }
           function OnClientSaving(sender, eventArgs) {
               //Some validation
               //if (true) {
               //    Save using server side code
               //}
           }
           function OnClientSaved(sender, eventArgs) {
               imageVer1Saved += 1;
           }
       </script>
   </telerik:RadScriptBlock>
   <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="false">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadImageEditor1" />
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
   </telerik:RadAjaxManager>
   <div class="borderFullWidthBoxSection">
       <div class="formSection">
           <h1>Upload new photo</h1>
           <div class="formContent">
               <telerik:RadAsyncUpload ID="AsyncUpload1" runat="server"
                   OnClientFilesUploaded="OnClientFilesUploaded" OnFileUploaded="AsyncUpload1_FileUploaded"
                   MaxFileSize="4194304" AllowedFileExtensions="jpg,png,gif,bmp"
                   AutoAddFileInputs="false" Localization-Select="Browse" Skin="Silk" HideFileInput="true" />
 
               <asp:Label ID="Label1" Text="*Size limit: 4MB" runat="server" Style="font-size: 10px;"></asp:Label>
               <telerik:RadImageEditor ID="RadImageEditor1" runat="server" Width="850" Height="550"
                   OnImageLoading="RadImageEditor1_ImageLoading" OnClientImageLoad="OnClientImageLoad" OnClientCommandExecuted="modifyCommand" Skin="Silk" OnClientSaved="OnClientSaved" OnClientSaving="OnClientSaving" >
                   <Tools>
                       <telerik:ImageEditorToolGroup>
                           <telerik:ImageEditorTool CommandName="Save" IsToggleButton="true"></telerik:ImageEditorTool>
                           <telerik:ImageEditorToolStrip CommandName="Undo">
                           </telerik:ImageEditorToolStrip>
                           <telerik:ImageEditorToolStrip CommandName="Redo">
                           </telerik:ImageEditorToolStrip>
                           <telerik:ImageEditorTool Text="Reset" CommandName="Reset" />
                            </telerik:ImageEditorToolGroup>
       <telerik:ImageEditorToolGroup>
                           <telerik:ImageEditorTool CommandName="Crop"></telerik:ImageEditorTool>
                           <telerik:ImageEditorTool CommandName="Resize"></telerik:ImageEditorTool>
                           <telerik:ImageEditorTool CommandName="FlipVertical" ToolTip="Flip Image Vertically"></telerik:ImageEditorTool>
                           <telerik:ImageEditorTool CommandName="FlipHorizontal" ToolTip="Flip Image Horizontally"></telerik:ImageEditorTool>
                           <telerik:ImageEditorTool CommandName="RotateRight" ToolTip="Rotate Right by 90 degrees"></telerik:ImageEditorTool>
                           <telerik:ImageEditorTool CommandName="RotateLeft" ToolTip="Rotate Left by 90 degrees"></telerik:ImageEditorTool>
            <telerik:ImageEditorTool Text="Add Text" CommandName="AddText" IsToggleButton="true" />
           <telerik:ImageEditorToolSeparator />
                           <telerik:ImageEditorTool CommandName="ZoomIn" ToolTip="Zoom In"></telerik:ImageEditorTool>
                           <telerik:ImageEditorTool CommandName="ZoomOut" ToolTip="Zoom Out"></telerik:ImageEditorTool>
                       </telerik:ImageEditorToolGroup>
                       <telerik:ImageEditorToolGroup>
           <telerik:ImageEditorTool Text="Brightness Contrast" CommandName="BrightnessContrast" IsToggleButton="true" />
           <telerik:ImageEditorTool Text="Invert Color" CommandName="InvertColor" />
           <telerik:ImageEditorTool Text="Sepia" CommandName="Sepia" />
           <telerik:ImageEditorTool Text="Greyscale" CommandName="Greyscale" />
           <telerik:ImageEditorTool Text="Hue Saturation" CommandName="HueSaturation" IsToggleButton="true" />
       </telerik:ImageEditorToolGroup>
       <telerik:ImageEditorToolGroup>
           <telerik:ImageEditorTool Text="Pencil" CommandName="Pencil" IsToggleButton="true" />
           <telerik:ImageEditorTool Text="Draw Circle" CommandName="DrawCircle" IsToggleButton="true" />
           <telerik:ImageEditorTool Text="Draw Rectangle" CommandName="DrawRectangle" IsToggleButton="true" />
           <telerik:ImageEditorTool Text="Line" CommandName="Line" IsToggleButton="true" />
       </telerik:ImageEditorToolGroup>
                   </Tools>
               </telerik:RadImageEditor>
           </div>
       </div>
   </div>

Vessy
Telerik team
 answered on 09 Apr 2014
2 answers
203 views
I'm working on a web control that updates contact information, and I call that web control via the RadGrid  .... the way I have it set up is, the RadGrid shows a list of the contacts, and then I click Edit in the RadGrid, to link to the contact update web control as part of the EditFormSettings.

The problem I'm having, is when I add the code to  that uses Google Places Autocomplete to do the address validation.

The code I'm embedding for the address validation is as per the example at this page: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform

The problem is, that the Autocomplete WILL NOT WORK, when the control is called from inside the RadGrid for the Edit event.

Yet, when I move the control to anywhere else, it works just fine.

Seems like the extra event handlers that are bound to my Address Search box by Telerik, are somehow interfering with the AJAX for the Google Autocomplete?  That is only a guess.

Any advice much appreciated, thanks in advance!!!
rdmptn
Top achievements
Rank 1
 answered on 09 Apr 2014
1 answer
96 views
This is SharePoint 2010 server .I can run the SPRadGrid web part from a Parent site with no trouble accessing a SharePoint list on but when I try the same thing on a child site I get the following errors in the ULS logs.

​Application error when access /sites/home/teststan/SitePages/New.aspx, Error=Object reference not set to an instance of an object.
at Telerik.Ajax.SharePoint.GridSPListTableViewBuilder.BuildGridStructureInternal(SPListBindingStructure tableView, GridTableView gridTableView)
at Telerik.Ajax.SharePoint.GridSPListTableViewBuilder.BuildDataStructure()
at Telerik.Ajax.SharePoint.SPListBinder.SetUpGridControlOnInitialLoad()
at Telerik.Ajax.SharePoint.GridBindingManager.CreateRadGridControl()
at Telerik.Ajax.SharePoint.TelerikSPRadGridWebPart.CreateRadGridControl()
at Telerik.Ajax.SharePoint.TelerikSPRadGridWebPart.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at Telerik.Ajax.SharePoint.TelerikDataBoundWebPart.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at System.Web.UI.WebControls.WebParts.WebPartManager.WebPartManagerControlCollection.AddWebPartHelper(WebPart webPart)
at System.Web.UI.WebControls.WebParts.WebPartManager.WebPartManagerControlCollection.AddWebPart(WebPart webPart)
at System.Web.UI.WebControls.WebParts.WebPartManagerInternals.AddWebPart(WebPart webPart)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartWithRetry(WebPart webPart)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.LoadWebParts()
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnPageInitComplete(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnInitComplete(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

and

System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Ajax.SharePoint.GridSPListTableViewBuilder.BuildGridStructureInternal(SPListBindingStructure tableView, GridTableView gridTableView)
at Telerik.Ajax.SharePoint.GridSPListTableViewBuilder.BuildDataStructure()
at Telerik.Ajax.SharePoint.SPListBinder.SetUpGridControlOnInitialLoad()
at Telerik.Ajax.SharePoint.GridBindingManager.CreateRadGridControl()
at Telerik.Ajax.SharePoint.TelerikSPRadGridWebPart.CreateRadGridControl()
at Telerik.Ajax.SharePoint.TelerikSPRadGridWebPart.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at Telerik.Ajax.SharePoint.TelerikDataBoundWebPart.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at System.Web.UI.WebControls.WebParts.WebPartManager.WebPartManagerControlCollection.AddWebPartHelper(WebPart webPart)
at System.Web.UI.WebControls.WebParts.WebPartManager.WebPartManagerControlCollection.AddWebPart(WebPart webPart)
at System.Web.UI.WebControls.WebParts.WebPartManagerInternals.AddWebPart(WebPart webPart)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartWithRetry(WebPart webPart)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.LoadWebParts()
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnPageInitComplete(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnInitComplete(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Marin
Telerik team
 answered on 09 Apr 2014
4 answers
374 views
I added Rad Content Menu to Rad grid but when i right click on Grid rows i don't see the menu coming up. Do i have to enable anything ? Please let me know.

Here is my code:

<script type="text/javascript">
         function RowContextMenu(index, e)
         {                       
             var menu = $find("<%=RadMenu1.ClientID %>");
             
              var evt = eventArgs.get_domEvent();
             var menuItem = menu.findItemByText("View");
            menuItem.set_navigateUrl("SalesDashboard.aspx?userType=VP&amp;MetricYear=2014&amp;SalesPerson=IACORP\Jeff.Rodgers");
            menu.show(evt);
            }

     </script>
                                                    

  <telerik:RadGrid ID="RadGrid1" Width="60.5%" runat="server" OnNeedDataSource="radGrid_NeedDataSource"            
                         AutoGenerateColumns="false" GroupingSettings-GroupByFieldsSeparator="" AllowMultiRowEdit="true" OnItemDataBound="RadGrid1_ItemDataBound" OnPreRender="RadGrid1_PreRender" ClientSettings-ClientEvents-OnColumnContextMenu="true" >
            <MasterTableView ShowGroupFooter="false" EditMode="InPlace" DataKeyNames="SalesPerson">
                                  
                <Columns>              
                            
                 <telerik:GridBoundColumn UniqueName="Jt.Calls" DataField="Jt. Calls" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"  ColumnGroupName="Monthly Activity" HeaderText="Jt. Calls" />
                 <telerik:GridBoundColumn UniqueName="Demos" DataField="Demos" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"  ColumnGroupName="Monthly Activity" HeaderText="Demos" />
                 
                </Columns>

                </MasterTableView>
          <ClientSettings>
            <ClientEvents OnRowContextMenu="RowContextMenu" />           
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
        </telerik:RadGrid>
   
 <telerik:RadContextMenu ID="RadMenu1" runat="server" Skin="Vista" EnableRoundedCorners="true" EnableShadows="true" OnItemClick="RadMenu1_ItemClick">
        <Targets>
               <telerik:ContextMenuControlTarget ControlID="RadGrid1" />
          </Targets>
            <Items>
             <telerik:RadMenuItem Text="View"  />
     
            </Items>
</telerik:RadContextMenu>         
              





Neetha
Top achievements
Rank 1
 answered on 09 Apr 2014
1 answer
74 views
Is there any way to have my vertical scrollbar enabled when my grid is disabled?  I have the condition where a grid is disabled but need the scrollbar to be enabled so users can scroll thru the items.
Stacy
Top achievements
Rank 1
 answered on 09 Apr 2014
7 answers
1.4K+ views
I realise that there are few topics concerning this issue, but mine seems to be different.

Here is some information.
I recently uninstalled all previous versions of RadControls for ASP.Net because I was getting conflicts between different versions and having some issues when trying to modify the site from my home machine. So, once I uninstalled everything, I installed the latest build of the rad controls hoping that that would fix any issues I was having.
My home machine works fine, but my work machine will not work. The rad controls are displayed on a page but with no styling and they do not actually work, but no errors are thrown when building the site.
The only thing is the unrecognized tag prefix green underline.

I have read that putting the Telerik.Charting.dll into the bin folder fixes this issue, but the only version of this DLL I have is from a cached version which resides here:

C:\Program Files\Telerik\Telerik Trainer\CachedAssemblies\RadControls for ASP.NET AJAX\Q1 2008\Bin

Using this dll causes my website to break. A 'ASP.NET Ajax client-side framework failed to load.' error is thrown.

There is no other version to this dll anywhere. Is there something I am missing or is there a new solution to this problem?



Pavlina
Telerik team
 answered on 09 Apr 2014
1 answer
140 views
I have a grid with on of the column as below:
<telerik:GridBoundColumn DataField="productID" HeaderText="Product ID" UniqueName="productID" FilterControlWidth="70%" ColumnGroupName="ColGroup1" ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"/>
When I type "<something>" in the input field and try to search I get and error. See attachment. However this error is displayed inside a error page that appears inside my iframe. How can I handle this error. I don't want to have an error inside a page inside my iframe. 
Thank you...
Pavlina
Telerik team
 answered on 09 Apr 2014
1 answer
487 views
I use this snippet to export to excel all the data in RadGrid, viable and not visible, with some columns filtered out:

protected void ExpExcel_Click(object sender, EventArgs e)
{
    foreach (GridColumn col in RadGrid1.MasterTableView.Columns)
    {
        if (col.UniqueName.Contains("notes") || (col.UniqueName.Contains("EditCommandColumn")) ||
            (col.UniqueName.Contains("column1")))
        {
            col.Display = false;
        }
        else
        {
            col.Display = true;
        }
    }
    foreach (GridFilteringItem item in RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem))
        item.Visible = false;
    RadGrid1.ExportSettings.ExportOnlyData = true;
    RadGrid1.MasterTableView.ExportToExcel();       
}
It is working fine. My problem is with two columns where the values are exported with the formatting "." and "$" that I do not won't to be exported. Is there a way to replace those two chars with "" or to avoid the formatting to get exported?
Princy
Top achievements
Rank 2
 answered on 09 Apr 2014
3 answers
209 views
hi
first i sorry for my poor English

i have grid in batch mode whit row EditType . i have radtextbox and RadNumericTextBox in edititemtamplate . i want when the value/text of these change a client event fire.
when i use textchanged of radtextbox when i click on another row with cell have different value the event fire too and i don't want this.in keypress i cant get tab button because when i press tab focus changed and focus  another cell and don't fire event.

when i use these event:
OnBatchEditGetEditorValue
OnBatchEditSetEditorValue
OnBatchEditSetCellValue
OnBatchEditGetCellValue
OnBatchEditCellValueChanged
OnBatchEditCellValueChanging

all of them fire after selected row change

now what witch event i can use?
Kostadin
Telerik team
 answered on 09 Apr 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?