Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
82 views

I try to make a RadListBox inside the Custom Dialog. I would like to pass the value from RadListBox to parent page when I double clicking on it. I try using editor.pasteHtml funcion in double click event of RadListBox but it won't work.
Could you please tell me where I went wrong.
My source code like below.

WebForm.aspx

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebEditor.WebForm1" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <Scripts>
                    <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>    
                
                Telerik.Web.UI.Editor.CommandList["InsertLexicon"] = function (commandName, editor, args) {
                    var myCallbackFunction = function (sender, args) {
                        editor.pasteHtml(args.image);
                    }
 
                    editor.showExternalDialog(
                    "InsertLexicon.aspx",
                    {},
                    400,
                    560,
                    myCallbackFunction,
                    null,
                    "InsertLexicon",
                    true,
                    Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
                    false,
                    true);
                };
 
                function pasteLexicon(myData)
                {               
                    var editor = $find('<%= edComment.ClientID%>');
                    editor.pasteHtml(myData);
                }
            </script>
            <br />
            <br />
            <br />
       <br />
            <telerik:RadEditor RenderMode="Lightweight" runat="server" ID="edComment" EditType="Inline" NewLineMode="Br" ToolsFile="ToolsFile.xml">
            </telerik:RadEditor>
            
        
        </div>
    </form>
</body>
</html>

 

InsertLexicon.aspx

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="InsertLexicon.aspx.vb" Inherits="WebEditor.InsertLexicon" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <link href="StyleSheets/Editor.css" rel="stylesheet" type="text/css" />
    <title>InsertLexicon</title>
 
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <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 getRadWindow() //mandatory for the RadWindow dialogs functionality
            {             
                if (window.radWindow) {
                    return window.radWindow;
                }
                if (window.frameElement && window.frameElement.radWindow) {
                    return window.frameElement.radWindow;
                }
                return null;
            }
 
            function initDialog() //called when the dialog is initialized
            {
                var clientParameters = getRadWindow().ClientParameters;
            }
 
            if (window.attachEvent) {
                window.attachEvent("onload", initDialog);
            }
            else if (window.addEventListener) {
                window.addEventListener("load", initDialog, false);
            }
 
            function insertLexicon() //fires when the Insert Link button is clicked
            {
                var closeArgument = {};
                var list = $find("<%= listComment.ClientID%>");
                var item = list.get_selectedItem();
                if (item == null || item == undefined) {
                    alert("請選擇詞庫");
                    return false;
                }
                else {
                    closeArgument.image = item.get_value();
                    getRadWindow().close(closeArgument);
                }
            }
 
            function closeWindow() {
                getRadWindow().close();
            }
 
            function OnClientItemDoubleClicked(sender, args)
            {                  
                var closeArgument = {};
                var list = $find("<%= listComment.ClientID%>");
                var item = list.get_selectedItem();
                getRadWindow().get_browserWindow().pasteLexicon(item.get_value());           
            }
            
        </script>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
 
      <!--Tool-->           
        <telerik:RadListBox RenderMode="Lightweight" runat="server" ID="listComment" Height="350px" Width="100%"  ButtonSettings-AreaWidth="35px"
          OnClientItemDoubleClicked="OnClientItemDoubleClicked">
            <Items>
                <telerik:RadListBoxItem Text="Value1" Value="value1"></telerik:RadListBoxItem>
                <telerik:RadListBoxItem Text="Value2" Value="Value2"></telerik:RadListBoxItem>
            </Items>
        </telerik:RadListBox>
        <br />   
        <div >
            <telerik:RadButton RenderMode="Lightweight" AutoPostBack="false" ID="RadButton6" runat="server" OnClientClicked="insertLexicon" Text="Save" />
            <telerik:RadButton RenderMode="Lightweight" AutoPostBack="false" ID="RadButton7" runat="server" OnClientClicked="closeWindow" Text="Close" />
        </div>
    </form>
</body>
</html>

Alan
Top achievements
Rank 1
 asked on 31 May 2016
2 answers
102 views

Hi,

We have a grid and a custom skin for it. In order to show grid images for "Add New", "Edit", "Delete", "Filter", etc... we put all grid related images into "~/images/grid" directory, based on this article 

http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/appearance-and-styling/skins

However, we also use buttons "Export To PDF" and "Export To Excel", which correct names are not mentioned in the above article. 

What are the correct names we should use for these button so the images show in the grid header?

Thanks,

Evgeniya

 

 

Evgeniya
Top achievements
Rank 1
 answered on 30 May 2016
2 answers
91 views
I need have a RadRibbonBar with four main tabs. I cannot seem to find any documentation about adding images on the tab itself. The RadTabStrip has an ImageURL property. Would I have to use a TemplateControl to achieve this?
Ivan Danchev
Telerik team
 answered on 30 May 2016
3 answers
438 views
I would like to set the height of the listbox to show 5 rows of data.  The rows are simple text entries using RadListBoxItem.  In order to set the height, it seems like I would have to calculate the height of one item and multiple that by the number of rows that I want to show.  Then, set the height of the listbox to this value.

The "height" property for the RadListItem is blank before adding to a listbox, after adding to a listbox, and after adding to an update panel on the page.  I kind of figured this was the case given that the style sheet may cause the size to change.

So, how should I set the height of a listbox assuming I want to show 5 items at a time?  Do I calculate it on the server side using best guess at the row size?  How well does that work for cross browser implementations?  Do I calculate it on the client side in javascript?

What would be the best approach to this?

Thanks

Michael
Ivan Danchev
Telerik team
 answered on 30 May 2016
3 answers
123 views
Hi all,

I'm running RAD Editor full featured on a MOSS 2007 env (RAD 5.7.1.0), and I've added some custom file extension to be allowed in the Media Manager:
<property name="MediaFilters">
   <item>*.wmv</item>
   <item>*.avi</item>
   <item>*.mpeg</item>
   <item>*.mpg</item>
   <item>*.mov</item>
   <item>*.flv</item>
   <item>*.m4v</item>
   <item>*.mp3</item>
   <item>*.mp4</item>
 </property>

I'm having troubles for some files of thoses extensions. If I upload a mp4 file, the upload works fine but after the media manager refreshes the content of my document library it does not shows my mp4 file.

And I don't have this problem for mov or flv files...

Any clue on this ?
Sandeep
Top achievements
Rank 1
 answered on 30 May 2016
1 answer
317 views

Hi,

When a document is uploaded through document manager in telerik editor, Is it possible to

              Save the document in different server shared folder path?

              Save a uploaded document in two different path at the same time ?

 

Currently we are save the uploaded files in same server as below,

                       editor.SetPaths(new string[] { "~/users/downloads"}, EditorFileTypes.Documents, EditorFileOptions.All);

 

Thanks

 

Marin Bratanov
Telerik team
 answered on 30 May 2016
1 answer
135 views

I have received the data in json format as follows:

var mydata = [
{
"Title":"My Grid Example",
"NumberOfColumns":4,
"DatasetHeader":{"items":[
{"Name":"FullName","Type":"System.String"},
{"Name":"Age","Type":"System.Int32"},
"Name":"Address","Type":"System.String"},
{"Name":"Cost","Type":"System.Double"}
]},
"Rows":["items":[
{"Rohan","12","Arab","234"},
{"Radha","11","Texas","123"},
{"Haris","22","NPL","344"},
{"Christine","23","Arab","674"},
{"Tot","22","UK","434"},
{"Terry","21","LA","334"},
{"Savana","19","SA","224"}
]}
}];

Now, I want to generate the dynamic grid with the above data with 4 columns and 7 rows (for this case) . The columns can varies during runtime (from 2-3 to 14-15)

Something like this is expected:

<script>

$(document).ready(function () {

generateGrid(mydata);

}

function generateGrid(receiveddata) {

$("#table-grid").kendoGrid({

dataSource: { data: receiveddata.Rows.Items},

height: 400,
scrollable: true,

schema: {
        model: receiveddata.DatasetHeader.items
      },

title: receiveddata.title

});

} //end of javascript function

</script>

<div id="table-grid"></div>

Konstantin Dikov
Telerik team
 answered on 30 May 2016
1 answer
155 views

Hi,

I'm having a problem with a RadEditor that I have on a RadWindow. When I set the height above about 140px, The editable part only fills up the first 140px, but the frame is the size I've defined. See that attached image for a better description than I can give.

Here's the markup:

<telerik:RadEditor ID="redLogText" runat="server" EditModes="Design"
    MaxTextLength="4000" SkinID="DefaultSetOfTools" ContentAreaMode="Div" OnClientInit="CharCountInit"
    Height="255px" Width="70%" Style="background-color: White; display: inline-block;"
    Skin="Default">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorSeparator Visible="true" />
            <telerik:EditorTool Name="Cut" />
            <telerik:EditorTool Name="Copy" />
            <telerik:EditorTool Name="Paste" />
            <telerik:EditorSeparator Visible="true" />
            <telerik:EditorSplitButton Name="Undo" />
            <telerik:EditorSplitButton Name="Redo" />
            <telerik:EditorSeparator Visible="true" />
            <telerik:EditorTool Name="Bold" />
            <telerik:EditorTool Name="Italic" />
            <telerik:EditorTool Name="Underline" />
            <telerik:EditorSeparator Visible="true" />
            <telerik:EditorTool Name="JustifyLeft" />
            <telerik:EditorTool Name="JustifyRight" />
            <telerik:EditorTool Name="JustifyCenter" />
            <telerik:EditorSeparator Visible="true" />
            <telerik:EditorDropDown Name="FontName" />
            <telerik:EditorDropDown Name="FontSize" />
            <telerik:EditorSeparator Visible="true" />
            <telerik:EditorTool Name="AjaxSpellCheck" />
        </telerik:EditorToolGroup>
    </Tools>
    <Modules>
        <telerik:EditorModule Name="RadEditorStatistics" Visible="true" Enabled="true"></telerik:EditorModule>
    </Modules>
</telerik:RadEditor>

 

 

Marin Bratanov
Telerik team
 answered on 30 May 2016
3 answers
390 views

Hi... I use my document management system project radasyncupload. But when upload pdf file with radasyncupload after client download pdf file has problem. When clients open pdf file Failed to load PDF document error display in screen... 

 

<telerik:RadAsyncUpload ID="doc_upload" runat="server"
                                    ChunkSize="13000" Skin="MetroTouch" MultipleFileSelection="Automatic" Width="100%" PostbackTriggers="bt_accept">
                                    <Localization Select="..." Remove="Clear" />
                                    <FileFilters>
                                        <telerik:FileFilter Extensions="zip,xls,xlsx,doc,docx,pdf,jpg" />
                                    </FileFilters>
                                </telerik:RadAsyncUpload>

Ivan Danchev
Telerik team
 answered on 30 May 2016
1 answer
248 views

I have a grid that I have setup to dynamically change the pageSize based on the window size. When the browser window size changes I call the following code:

var grid = $("#grid").data("kendoGrid");

var currentPage = grid.dataSource.page();
var currentPageSize = grid.dataSource.pageSize();

if (currentPageSize !== newPageSize) {
    grid.dataSource.pageSize(newPageSize);
}

This works fine, but I noticed that the call to .pageSize(x) triggers a POST request to the server to fetch new data. Whenever I fetch new data from the server I need to run code based on whether or not the call to the server is successful or a failure. For example, when I want to refresh this grid manually (without changing the pageSize) I call:

grid.dataSource.read().then(function () {
    doStuffOnSuccess();
}).fail(function () {
    doStuffOnFailure();
});

Unfortunately there is no promise returned from the pageSize() method that would allow me to hook into the actual result of the POST request sent. As a result I have to call both the pageSize(x) and the manual grid.dataSource.read() methods together, and this generates two POST requests that degrades performance.

Is there some way of passing a new pageSize in the grid.dataSource.read() method? Or some way of seeing if the POST request triggered by pageSize(x) was successful or failed?

Rosen
Telerik team
 answered on 30 May 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?