Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
153 views
I'm using a RadListBox to drag and drop some values into a RadEditor, when I used it inFirefox it inserts de value where i have the cursor, but in IE it inserts the Radlistbox value always in the beginnig of the RadEditor content, i'm using the function: editor.pasteHtml("..."); as you have in the sample of emoticons, but no works for me..

Here I write me code lines:
<telerik:RadListBox ID="RadListbox1" runat="server" EnableDragAndDrop="True"  OnClientDragStart="OnClientDragStart" OnClientDragging="OnClientDragging" OnClientDropping="OnClientDropping"
        Width="250px" Height="100px" SelectionMode="Single" AllowDelete="false" >
        <ButtonSettings ReorderButtons="Common"></ButtonSettings>
    </telerik:RadListBox>
 
    <telerik:RadEditor OnClientLoad="OnClientLoad" ID="RadEditor1" runat="server" SkinID="DefaultSetOfTools" Visible="true" EditModes="Design"
        Height="500px" Width="650px" StripFormattingOnPaste="All" ToolsFile="~/App_GlobalResources/ToolsFile.xml"
        SpellCheckSettings-AllowAddCustom="false" SpellCheckSettings-DictionaryLanguage="es-ES"
        SpellCheckSettings-DictionaryPath="~/App_Data/RadSpell/" ContentAreaCssFile="EditorContentAreaStyles.css"  >
        <ImageManager EnableImageEditor="false" ViewPaths="" MaxUploadFileSize="512000" >
        </ImageManager>
        <Modules>
            <telerik:EditorModule Name="RadEditorStatistics" Visible="false" Enabled="true" />
            <telerik:EditorModule Name="RadEditorDomInspector" Visible="false" Enabled="true" />
            <telerik:EditorModule Name="RadEditorNodeInspector" Visible="false" Enabled="true" />
            <telerik:EditorModule Name="RadEditorHtmlInspector" Visible="false" Enabled="true" />                   
        </Modules>               
   

<script type="text/javascript">
//<![CDATA[
 
     function OnClientLoad(editor) {
         var list = $find("<%= RadListbox1.ClientID %>");
         makeUnselectable(list.get_element());
     }

     function OnClientDragStart() {         
         setOverlayVisible(true);
     }

     function OnClientDropping(sender, args) {
         var editor = $find("<%=RadEditor1.ClientID%>");        
         var event = args.get_domEvent();        
         document.body.style.cursor = "default";

         var result = isMouseOverEditor(editor, event);
       
         if (result) {
             var span_value = args.get_sourceItem().get_text();

             if (span_value) {                                 
                 editor.setFocus();
                 editor.pasteHtml("{" + span_value + "}");
                 args.set_cancel(true);
             }
         }
         setOverlayVisible(false);
     }

     function OnClientDragging(sender, args) {
         var editor = editor = $find("<%=RadEditor1.ClientID%>");
         var event = args.get_domEvent();
         
         if (isMouseOverEditor(editor, event)) {
             document.body.style.cursor = "hand";
         }
         else {
             document.body.style.cursor = "no-drop";
         }
     }

     /* ================== Utility methods needed for the Drag/Drop ===============================*/
     
     function makeUnselectable(element) {         
         var nodes = element.getElementsByTagName("li");
         
         for (var index = 0; index < nodes.length; index++) {
             var elem = nodes[index];             
             elem.setAttribute("unselectable", "on");
         }
     }

     //Create and display an overlay to prevent the editor content area from capturing mouse events
     var shimId = null;
     function setOverlayVisible(toShow) {
         if (!shimId) {
             var div = document.createElement("DIV");
             document.body.appendChild(div);
             shimId = new Telerik.Web.UI.ModalExtender(div);
         }

         if (toShow) shimId.show();
         else shimId.hide();
     }
     
     //Check if the image is over the editor or not
     function isMouseOverEditor(editor, events) {
     
         var editorFrame = editor.get_contentAreaElement();
         var editorRect = $telerik.getBounds(editorFrame);

         var mouseX = events.clientX;
         var mouseY = events.clientY;         

         if (mouseX < (editorRect.x + editorRect.width) &&
             mouseX > editorRect.x &&
                mouseY < (editorRect.y + editorRect.height) &&
             mouseY > editorRect.y) {
             return true;
         }
         return false;
     }

</script>


And I want to know if I can have another icon when I drag one item to the RadEditor, not the forbidden icon.

Thanks,

Rumen
Telerik team
 answered on 10 Nov 2011
1 answer
146 views
I'm exporting a grid to a CSV file, and am having a problem with the Byte Order Mark that is being placed in the first 3 characters of the file.

The exported grid is being imported directly into another (rather old and not changeable) application and failing with the inclusion of the BOM.

I've read here: http://www.telerik.com/help/aspnet-ajax/grid-csv-export.html that when exporting to a CSV file that the BOM is created automatically but I cannot find a way to stop this happening.

Cheers
Cliff
Princy
Top achievements
Rank 2
 answered on 10 Nov 2011
3 answers
125 views
Guys, i have defined a griddropdowncolumn but for some reason it is not displaying the bound value. When it edit mode, i populate the dropdown with no issues. Here is my column definition in the front end:

<telerik:GridDropDownColumn ListTextField="LotDetail.LotNumber" ListValueField="LotDetail.LotNumber" DataType="System.String"
            FilterControlAltText="Lot Number" HeaderText="Lot Number"
            SortExpression="LotDetail.LotNumber" UniqueName="LotNo" ReadOnly="true">
        </telerik:GridDropDownColumn>

If anyone could shed any light on this it would be great. My Telerik.Web.UI.dll version is 2011.2.915.40.
Michael
Top achievements
Rank 1
 answered on 10 Nov 2011
1 answer
42 views
Hi,

We need an urgent requirement, I want to know,is possible to achieve by Rad HTML editor.

Following Requirement:
1. We load the custom XML tags to html editor from database (values from database in xml datatype.)
    like <store><cabs></cabs></store>
2. We need to give link for external stylesheet for that tags (store,cabs).
3. In html editor ,after load the xml content . we place cursor in any position,we want to know the hierarchical node (upto parent node) details like breadcrumb on bottom
 for e.g., <store><cabs>This is sample text</cabs></store>
 
             if we place the cursor in content ,display like 'store > cabs >'

4. Need to get the current cursor position.

Thank you,
Rumen
Telerik team
 answered on 10 Nov 2011
2 answers
185 views
I open a modal rad window using the code below and specify a callback function to display a confirmation message to make sure the user wants to close the window. Everything works fine if the window is opened to a specific size. However, if I open the window and then maximize it, when the user attempts to close the window, it seems that the the confirm message gets displayed "behind" the rad window. Since it is maximized, the user cannot see it. The window doesn't close and there is no indication to the user. I'm not sure why the massage appears "on top" of the rad window if it is opened to a particular size, but behind if it is maximzed, however is there a way to make sure the confirmaiton message is always on top of the active rad window, even if it is maximized?

function openWindow(someUrl, width, heigth, xPos, yPos) {
      
    var oWin =  window.radopen(someUrl, 'MyWindow');
    oWin.setActive(true);
     
    

      oWin.setSize(width, height);

    if (xPos != null && yPos != null) {
       oWin.moveTo(xPos, yPos);
   }
   else {
       oWin.center();
   
    oWin.maximize();
     oWin.add_beforeClose(onBeforeClose);
                         
}
         
function onBeforeClose(sender, arg) {
        function callbackFunction(arg) {
               if (arg) {
                   sender.remove_beforeClose(onBeforeClose);
                   sender.close();
                }
           }
           arg.set_cancel(true);
           radconfirm("Are you sure you want to close this window?", callbackFunction, 400, 150, null, "Close Window");
       }
 
Marin Bratanov
Telerik team
 answered on 10 Nov 2011
1 answer
153 views
Hi I'm having a bit of an issue with the RadWindow with FF 7.01... for some reason, there is a border around it..When I click on the title bar and move it, it disappears but the sec i release the window it reappears... This is not happening in Chrome15 , IE 9

I'm calling it using

<telerik:RadWindowManager ID="wndManager" runat="server" Skin="Outlook">
    <Windows>
        <telerik:RadWindow ID="wndSetUp" runat="server" BorderStyle="None" EnableShadow="True"
            Height="730px" KeepInScreenBounds="True" Modal="True" NavigateUrl="InitialSetUp.aspx"
            Overlay="True" ShowContentDuringLoad="False" Style="display: none;" Title=" First Time Setup"
            Visible="False" VisibleStatusbar="False" Width="900px" VisibleTitlebar="True"
            Behavior="Close, Move" Behaviors="Close, Move" Skin="Outlook">
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
Marin Bratanov
Telerik team
 answered on 10 Nov 2011
9 answers
270 views
We have a customer with the website www.customer.com. When a visitor enters the site a RadWindow is opened with a survey. This survey comes from the domain survey.customer.com (both located on the same physical server).

This works just fine, but when trying to close the RadWindow with anything other than the "x" in the top right a javascript error occurs, saying Access Denied.

This is from the FireFox error console:
Error: Permission denied for <http://survey.customer.com> to get property HTMLIFrameElement.radWindow from <http://www.customer.com>. 
Source File: http://survey.customer.com/content/pages/smallstartpage.aspx?code=123 
Line: 36 

I'm calling a javascript-function CloseRadWindow on survey.customer.com to close the RadWindow.

Here is the javascript used:
<script type="text/javascript" language="javascript"
        function GetRadWindow() { 
            var oWindow = null
            if (window.radWindow) oWindow = window.radWindow; 
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; 
            return oWindow; 
        } 
 
        function CloseRadWindow() { 
            var oWindow = GetRadWindow(); 
            if (oWindow != null
                oWindow.Close(); 
            else 
                close(); 
        } 
    </script> 

Is there any solution to this? I have used a similar approach for another customer, but at that time both pages where on the same domain/subdomain - I suspect the issue might be different subdomains here?

If there are any other easy ways to close the RadWindow from within the RadWindow itself I'm happy to hear about it.

FYI: No error is displayed when testing on the dev-computer running both projects on localhost.

Br,
Hans






wnl
Top achievements
Rank 1
 answered on 10 Nov 2011
5 answers
286 views
Hi All,

I have a context menu targeting a RadGrid.  I've successfully figured-out some pretty complex stuff with the menu and the grid, but I am stuck on what seems like a very simple issue.  To make this easy to discuss, I've simplified my problem.

The bottom line is that I am having a difficulty capturing the "clicked item" in JS.  The procedure I am using is almost exactly as described in here:  http://www.telerik.com/help/aspnet-ajax/menu-onclientitemclicked.html

In short, my context menu is targeting my grid, no problem.  Also, my on click event is firing as well.  Here is a simplified version:

function OnContextMenu_Grid(sender, args) {
    var myMenuItem = args.get_item().get_value();
    alert(myMenuItem)
 
}

Here is my context menu config:

<telerik:RadContextMenu ID="FlowsContextMenu" Runat="server"
        onclientitemclicked="OnContextMenu_Grid">
        <Targets>
            <telerik:ContextMenuControlTarget ControlID="RadGrid1" />
        </Targets>
        <Items>
            <telerik:RadMenuItem runat="server" Text="EDIT This Item">
            </telerik:RadMenuItem>
            <telerik:RadMenuItem runat="server" IsSeparator="True" Text="Line">
            </telerik:RadMenuItem>
            <telerik:RadMenuItem runat="server" Text="Add One">
                <Items>
                    <telerik:RadMenuItem runat="server" Text="Normal Flow">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" Text="Alternate Flow">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" Text="Business Rule">
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadMenuItem>
        </Items>
    </telerik:RadContextMenu>


However, when the event fires "myMenuItem" is null.  The alert window pops up, but still a null value.  I figure this is probably something simple, but I cannot spot it.  I would really appreciate some help.

The code for my entire page is attached below.  Thank you so much for any help!

Jim



<%@ Page Language="VB" AutoEventWireup="false" CodeBehind="ContextTest.aspx.vb" Inherits=".ContextTest" %>
 
<!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">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
 
        function OnContextMenu_Grid(sender, args) {
            var myMenuItem = args.get_item().get_value();
            alert(myMenuItem)
 
        }
 
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadContextMenu ID="FlowsContextMenu" Runat="server"
        onclientitemclicked="OnContextMenu_Grid">
        <Targets>
            <telerik:ContextMenuControlTarget ControlID="RadGrid1" />
        </Targets>
        <Items>
            <telerik:RadMenuItem runat="server" Text="EDIT This Item">
            </telerik:RadMenuItem>
            <telerik:RadMenuItem runat="server" IsSeparator="True" Text="Line">
            </telerik:RadMenuItem>
            <telerik:RadMenuItem runat="server" Text="Add One">
                <Items>
                    <telerik:RadMenuItem runat="server" Text="Normal Flow">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" Text="Alternate Flow">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" Text="Business Rule">
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadMenuItem>
        </Items>
    </telerik:RadContextMenu>
    <br />
    <div>
 
        <br />
        <br />
        <br />
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="None">
            <ClientSettings>
                <Selecting AllowRowSelect="True" />
                <ClientEvents />
            </ClientSettings>
            <MasterTableView DataSourceID="SqlDataSource1" ClientDataKeyNames="UseCaseID">
                <CommandItemSettings ExportToPdfText="Export to PDF" />
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="UseCaseID" DataType="System.Int32"
                        FilterControlAltText="Filter UseCaseID column" HeaderText="UseCaseID"
                        SortExpression="UseCaseID" UniqueName="UseCaseID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CaseName"
                        FilterControlAltText="Filter CaseName column" HeaderText="CaseName"
                        SortExpression="CaseName" UniqueName="CaseName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CrossCase"
                        FilterControlAltText="Filter CrossCase column" SortExpression="CrossCase"
                        UniqueName="CrossCase" HeaderText="CrossCase">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Tallys"
                        FilterControlAltText="Filter Tallys column" SortExpression="Tallys"
                        UniqueName="Tallys" HeaderText="Tallys">
                    </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <EditItemStyle BorderStyle="None" />
            <HeaderStyle BorderStyle="None" />
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
        </telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:DatabaseUseCase1 %>"
            SelectCommand="SELECT UseCaseID, CaseName, CrossCase, Tallys FROM v_CaseTree WHERE (CaseParentID = 45) AND (AlternateFlowYN = 2) ORDER BY CaseSort">
        </asp:SqlDataSource>
        <br />
 
    </div>
    </form>
</body>
</html>





Raj
Top achievements
Rank 1
 answered on 10 Nov 2011
1 answer
126 views
Hi,
I have tried changing the font size of rad doc.
I changed font-size from Medium to Large, but it changing only in the design mode, where as it's not chnaging in the
run time.Runtime the font is fixed, irrespective of what font-size I have given.
Please help.
Thanks,
Sijo.
Princy
Top achievements
Rank 2
 answered on 10 Nov 2011
2 answers
107 views
Hi,

We have an application using several RadGrids for different user data listings. In all of them we have the user registration date as a GridDateTimeColumn. When setting AllowFiltering="true" for that column the width of the Grid becomes totally screwed up on the Ipad or any other IOS device. The Grid becomes so wide it's not even possible to scroll sideways that far... When setting the value to false the Grid stays within the page boundaries and is about 700 or 800 px wide. All other columns work fine with filtering.

Has anybody come across this problem?

Thanks!

/Christofer
Christofer Hagstedt
Top achievements
Rank 1
 answered on 10 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?