Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
121 views
Hi, i am new to rad editor.

i want to get the editor content in java script on button click.

So i am using the following code.

'  var editor = $find("<%#radEditor.ClientID%>"); //get a reference to RadEditor client object    

        var editorContent = editor.get_html();
      
'

i am using with master page.

so i try to get editor like document.getElementById('ct100_cpEditor_radEditor')
but i cant use the get_html() method with this id.
and document.getElementById('radeditor')-this return null.

how to get the editor object in java script?

Thanks,
Uma

Rumen
Telerik team
 answered on 12 Jan 2012
0 answers
59 views

Hi Team,

I have the following design (attached screenshot) in my web application.

Controls at leftside zones are usercontrols. what my need is, when I click any controls at leftside its getting loaded at the rightside.

I want to prevent it. I want allow users only to drag and drop from left side to right side.

Pls. help me.

<div id="leftAddFieldsContainer">

                                        <asp:Table runat="server">

                                            <asp:TableRow>

                                                <asp:TableCell>

                                                    <IKEA:RadDockLayoutNew runat="server" ID="uxLeftDockLayout1" EnableViewState="false">

                                                        <IKEA:RadDockZoneNew runat="server" Width="100" Orientation="Horizontal" FitDocks="True"

                                                            ID="uxLeftDockZone1" CssClass="leftDockZone">

                                                            <IKEA:RadDockNew runat="server" ForbiddenZones="uxLeftDockZone2" AutoPostBack="false"

                                                                BackColor="Transparent" OnClientInitialize="LeftDocksOnClientInitialize" ID="uxDockSingleLineText"

                                                                DockHandle="None" OnClientDragStart="OnClientDragStart" OnClientDragEnd="OnClientDragEnd"

                                                                OnClientDockPositionChanged="OnDockDropped" EnableAnimation="False">

                                                                <ContentTemplate>

                                                                    <asp:Image runat="server" ID="uxAddSingleLineText" ImageUrl="Images/SingleLineText.png" />

                                                                </ContentTemplate>

                                                            </IKEA:RadDockNew>

                                                            <IKEA:RadDockNew runat="server" ForbiddenZones="uxLeftDockZone2" AutoPostBack="false"

                                                                BackColor="Transparent" OnClientInitialize="LeftDocksOnClientInitialize" ID="uxDockMultiLineText"

                                                                DockHandle="None" OnClientDragStart="OnClientDragStart" OnClientDragEnd="OnClientDragEnd"

                                                                OnClientDockPositionChanged="OnDockDropped" EnableAnimation="False">

                                                                <ContentTemplate>

                                                                    <asp:Image runat="server" ID="uxAddMultiLineText" ImageUrl="Images/MultiLineText.png" />

                                                                </ContentTemplate>

                                                            </IKEA:RadDockNew>

                                                            <IKEA:RadDockNew runat="server" ForbiddenZones="uxLeftDockZone2" AutoPostBack="false"

                                                                BackColor="Transparent" OnClientInitialize="LeftDocksOnClientInitialize" ID="uxDockCheckboxes"

                                                                DockHandle="None" OnClientDragStart="OnClientDragStart" OnClientDragEnd="OnClientDragEnd"

                                                                OnClientDockPositionChanged="OnDockDropped" EnableAnimation="False">

                                                                <ContentTemplate>

                                                                    <asp:Image runat="server" ID="uxAddCheckboxes" ImageUrl="Images/Checkboxes.png" />

                                                                </ContentTemplate>

                                                            </IKEA:RadDockNew>

                                                            <IKEA:RadDockNew runat="server" ForbiddenZones="uxLeftDockZone2" AutoPostBack="false"

                                                                BackColor="Transparent" OnClientInitialize="LeftDocksOnClientInitialize" ID="uxDockMultipleChoice"

                                                                DockHandle="None" OnClientDragStart="OnClientDragStart" OnClientDragEnd="OnClientDragEnd"

                                                                OnClientDockPositionChanged="OnDockDropped" EnableAnimation="False">

                                                                <ContentTemplate>

                                                                    <asp:Image runat="server" ID="uxAddMultipleChoice" ImageUrl="Images/Choices.png" />

                                                                </ContentTemplate>

                                                            </IKEA:RadDockNew>

                                                            <IKEA:RadDockNew runat="server" ForbiddenZones="uxLeftDockZone2" AutoPostBack="false"

                                                                BackColor="Transparent" OnClientInitialize="LeftDocksOnClientInitialize" ID="uxDockFileUpload"

                                                                DockHandle="None" OnClientDragStart="OnClientDragStart" OnClientDragEnd="OnClientDragEnd"

                                                                OnClientDockPositionChanged="OnDockDropped" EnableAnimation="False">

                                                                <ContentTemplate>

                                                                    <asp:Image runat="server" ID="uxAddFileUpload" ImageUrl="Images/FileUpload.png" />

                                                                </ContentTemplate>

                                                            </IKEA:RadDockNew>

                                                         </IKEA:RadDockZoneNew>

                                                    </IKEA:RadDockLayoutNew>

                                                </asp:TableCell>

                                                <asp:TableCell>

                                                    <IKEA:RadDockLayoutNew runat="server" ID="uxLeftDockLayout2">

                                                        <IKEA:RadDockZoneNew runat="server" ForbiddenZones="uxLeftDockZone1" Orientation="Horizontal"

                                                            FitDocks="True" ID="uxLeftDockZone2" EnableViewState="false" CssClass="leftDockZone">

                                                            <IKEA:RadDockNew runat="server" AutoPostBack="false" BackColor="Transparent" OnClientInitialize="LeftDocksOnClientInitialize"

                                                                ID="uxDockDropDown" DockHandle="None" OnClientDragStart="OnClientDragStart" OnClientDragEnd="OnClientDragEnd"

                                                                OnClientDockPositionChanged="OnDockDropped" EnableAnimation="False">

                                                                <ContentTemplate>

                                                                    <asp:Image runat="server" ID="uxAddDropDown" ImageUrl="Images/DropDown.png" />

                                                                </ContentTemplate>

                                                            </IKEA:RadDockNew>

                                                            <IKEA:RadDockNew runat="server" ForbiddenZones="uxLeftDockZone1" AutoPostBack="false"

                                                                BackColor="Transparent" OnClientInitialize="LeftDocksOnClientInitialize" ID="uxDockMatrix"

                                                                DockHandle="None" OnClientDragStart="OnClientDragStart" OnClientDragEnd="OnClientDragEnd"

                                                                OnClientDockPositionChanged="OnDockDropped" EnableAnimation="False">

                                                                <ContentTemplate>

                                                                    <asp:Image runat="server" ID="uxAddMatrix" ImageUrl="Images/Matrix.png" />

                                                                </ContentTemplate>

                                                            </IKEA:RadDockNew>

                                                            <IKEA:RadDockNew runat="server" ForbiddenZones="uxLeftDockZone1" AutoPostBack="false"

                                                                BackColor="Transparent" OnClientInitialize="LeftDocksOnClientInitialize" ID="uxDockSectionBreak"

                                                                DockHandle="None" OnClientDragStart="OnClientDragStart" OnClientDragEnd="OnClientDragEnd"

                                                                OnClientDockPositionChanged="OnDockDropped" EnableAnimation="False">

                                                                <ContentTemplate>

                                                                    <asp:Image runat="server" ID="uxAddSectionBreak" ImageUrl="Images/SectionBreak.png" />

                                                                </ContentTemplate>

                                                            </IKEA:RadDockNew>

                                                        </IKEA:RadDockZoneNew>

                                                    </IKEA:RadDockLayoutNew>

                                                </asp:TableCell>

                                            </asp:TableRow>

                                        </asp:Table>

                                    </div>

//Thanks

raaj
Top achievements
Rank 1
 asked on 12 Jan 2012
5 answers
125 views
Hi ,
While configuring AJAX Manager , I selected the RadGrid1 as the Initiate for AJAX Request  and the control for Update i selected the same Rad Grid 1 .
Get an error saying  " Error Invoking 'Configure Ajax Manager' Details : Exception has been thrown by the target of an invocation   "
Unable to find the solution , kindly suggest me.

Thanks in advance!
Maria Ilieva
Telerik team
 answered on 12 Jan 2012
1 answer
99 views
How to highlight rad menu,

I was able to highlight only main menu or sub menu. but i want to highlight both main and sub menu. some time my sub menu has that own sub menu. durring that time i want to highlight all the 3 main sub and sub menus, sub menu i want to highlight. any one can help me in this.
Kate
Telerik team
 answered on 12 Jan 2012
3 answers
481 views
HI,
I have a grid that serves multi purpose. The data pass to the grid is dynamic. And hence i set AutoGenerateColumns="True"
I need to change the column header text to different different text in  different situation based on column index.
All the resources found online manage to change the header text of a particular column based on column Unique name.

Does anyone has idea on this?
Help Please!!

Tsvetina
Telerik team
 answered on 12 Jan 2012
1 answer
126 views
Why absolute positioning not working in google chrome?
Dobromir
Telerik team
 answered on 12 Jan 2012
0 answers
85 views
Good morning.
    I'm developing a Windows Form application where the user can build his own web application. I want to know whether it's possible to display a control from the Telerik Ajax Asp.net library in a windows form (runtime). I saw there are Telerik.Web.Design.dll and Telerik.Web.UI.dll, but i don't know if it's possible to use these dlls.
Or, is there any workaround to achive the desired behavior?

Thank you very much
Gianfranco
Franco
Top achievements
Rank 1
 asked on 12 Jan 2012
3 answers
315 views
Hi all,

I have a telerik radgrid in my page. In that check box column is there. If we check the checkbox and do the filtering or sorting for that column or other columns the checkbox will unchecked. Is any way is there to hold check box value. I got a solution for this by doing OnDataBound event in client side but I have arround 10,000 records so it will become little bit slower. so apart from this is any solution is there to hold the check box value after doing the sorting or filtering in the Grid. Thanks is advance for u r help.

Thanks,
Akki
Pavlina
Telerik team
 answered on 12 Jan 2012
0 answers
122 views

Hi,

I have some questions based on the below sample usercontrol code which contains a RadEditor control:

1) By trying to change the writing direction (RTL TO LTR or vise versa), Only by selecting the required paragraph and click on the required direction, the paragraph changes its direction. I need to enable the user to click the required direction and the cursor must be displayed in the required place, for example, In case there is no content on the RadEditor or the user clicked Enter to begin a new paragraph, if the user click RTL button, then the cursor must be displayed in the right (even if there is no content yet).

2) The same issue as 1, I face with the bullet list. I need to clcik the bullet list button and the first bullet must be displayed, even if there is no content (In the current case, I need to type at least one letter and put the cursor in the begining of the row and to click the bullet list button).

3) By caaling the user control within a FormView (Or any other control that needs DataSource), and trying to databind the EditorContent property as below, then, the content doesn't displayed, why? and how can I databind the radeditor control in my case?

My user control:
ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DefaultUserControl.ascx.cs" Inherits="Tmonavot.General_App_Controls_RadEditor_DefaultUserControl" %>
<link href="~/General/App/Controls/RadEditor/Style/Editor_RTL.css" rel="stylesheet" type="text/css" runat="server" id="EditorRtl" />
 
<style type="text/css">
    .reTool .Right-to-Left
    {
        background-image: url('<%= RTLIconUrl %>');
    }
     
    .reTool .Left-to-Right
    {
        background-image: url('<%= LTRIconUrl %>');
    }
</style>
 
<asp:Panel ID="ContentPanel" runat="server" Direction="LeftToRight" HorizontalAlign="Left" Width="100%">
    <telerik:RadEditor runat="server" ID="CntntRadEditor" Skin="Default" Height="400px" Width="680px" style="z-index:1001;">
        
    </telerik:RadEditor>
</asp:Panel>
 
<telerik:RadScriptBlock ID="dd" runat="server">
    <script type="text/javascript">
        Telerik.Web.UI.Editor.CommandList["Right-to-Left"] = function (commandName, editor, args) {
            var oElem = editor.getSelectedElement();
            if (oElem && oElem.tagName == "P") {
                oElem.setAttribute("dir", "rtl");
                oElem.style.textAlign = "right";
            }
 
            else if (editor.getSelectionHtml())//There is some selection   
            {
                var toPaste = "<p dir='rtl' style='text-align: right'>" + editor.getSelectionHtml() + "</p>";
                editor.pasteHtml(toPaste);
            }
        }
 
        Telerik.Web.UI.Editor.CommandList["Left-to-Right"] = function (commandName, editor, args) {
            var oElem = editor.getSelectedElement();
            if (oElem && oElem.tagName == "P") {
                oElem.setAttribute("dir", "ltr");
                oElem.style.textAlign = "left";
            }
 
            else if (editor.getSelectionHtml())//There is some selection   
            {
                var toPaste = "<p dir='ltr' style='text-align: left'>" + editor.getSelectionHtml() + "</p>";
                editor.pasteHtml(toPaste);
            }
        }
 
         
    </script>  
</telerik:RadScriptBlock>

usercontrol c#:

using System;
using Telerik.Web.UI;
using System.Web.UI.WebControls;
 
namespace Tmonavot
{
    public partial class General_App_Controls_RadEditor_DefaultUserControl : System.Web.UI.UserControl
    {
        public string RTLIconUrl = System.Web.VirtualPathUtility.ToAbsolute("~/General/App/Controls/RadEditor/CustomTools/Direction/RTL.png");
        public string LTRIconUrl = System.Web.VirtualPathUtility.ToAbsolute("~/General/App/Controls/RadEditor/CustomTools/Direction/LTR.png");
         
        protected void Page_Load(object sender, EventArgs e)
        {
            //Set the style for the PContentRadEditor content
            if (!IsPostBack)
            {
                CntntRadEditor.DialogsCssFile = "~/General/App/Controls/RadEditor/Style/RadEditor_Dialogs_RTL.css";
                CntntRadEditor.ContentAreaCssFile = "~/General/App/Controls/RadEditor/Style/EditorContentArea_RTL.css";
 
                //Set the RadEditor content and tabindex
                CntntRadEditor.Content = this.EditorContent;
            }
 
            //(FileUrlFileSelectorUserControl1.FindControl("FolderNameLabel") as Label).Text = "ContactUs";// (FileUrlFileSelectorUserControl1.FindControl("FileUrlRadTextBox") as RadTextBox).Text.ToString().Replace("~/Pages/", "");
            if (Resources.MngResource.ContentFloat.ToString().Equals("left"))
            {
                switchToLTR();
            }
            else
            {
                switchToRTL();
            }
        }
 
        private void switchToLTR()
        {
            ContentPanel.Direction = ContentDirection.LeftToRight;
            CntntRadEditor.DialogsCssFile = "";
            CntntRadEditor.ContentAreaCssFile = "";
            CntntRadEditor.CssFiles.Add(new EditorCssFile("~/General/App/Controls/RadEditor/Style/EditorContentArea_LTR.css"));
            EditorRtl.Attributes["Href"] = string.Empty;
        }
 
        private void switchToRTL()
        {
            ContentPanel.Direction = ContentDirection.RightToLeft;
            CntntRadEditor.DialogsCssFile = "~/General/App/Controls/RadEditor/Style/RadEditor_Dialogs_RTL.css";
            CntntRadEditor.ContentAreaCssFile = "~/General/App/Controls/RadEditor/Style/EditorContentArea_RTL.css";
            CntntRadEditor.CssFiles.Add(new EditorCssFile("~/General/App/Controls/RadEditor/Style/EditorContentArea_RTL.css"));
            EditorRtl.Attributes["Href"] = "General/App/Controls/RadEditor/Style/Editor_RTL.css";
        }
 
        public string EditorContent
        {
            get
            {
                //string s = Convert.ToString(ViewState["EditorContent"]);
                return Convert.ToString(ViewState["EditorContent"]);
            }
            set
            {
                ViewState["EditorContent"] = value;
            }
        }
    }
}

 

Sample formview control:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
                ConnectionString="<%$ ConnectionStrings:GeneralConnectionString %>"
                SelectCommand="SELECT * FROM [gPagesContent] WHERE ([PageID] = 41)">
            </asp:SqlDataSource>
               
            <asp:FormView ID="FormView1" runat="server" DataKeyNames="PageID"
                DataSourceID="SqlDataSource1" Width="100%">
                <ItemTemplate>
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                        <td valign="top" width="400">
                            <asp:Label ID="Label2" runat="server" Text="By displaying content using Label:" ></asp:Label>
                        </td>
                        <td valign="top" width="*">
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("PContent", "{0}") %>'></asp:Label>
                        </td>
                        </tr>
                        <tr>
                        <td valign="top" width="400">
                            <asp:Label ID="ContentLabel1" runat="server" Text="By displaying content using RadEditor:" ></asp:Label>
                        </td>
                        <td valign="top" width="*">
                            <uc1:DefaultUserControl ID="DefaultUserControl1" EditorContent='<%# Eval("PContent", "{0}") %>' runat="server" />
                        </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:FormView>


Please, I need your help,

Regards,
Bader

Bader
Top achievements
Rank 1
 asked on 12 Jan 2012
6 answers
345 views
Hello ,

  I have a RadMenu in my web application. For one of the Rad Menu Item, I would like to open the form in new window. I have tried the Target="_blank". It is not working. I also tried through javascript
function clickHandler(sender, eventArgs)
          {    
        
              if (eventArgs.item.Text == "LunchBreak")
              {
                   //open a pre-defined window from the RadWindowManager's
                   //Windows collection
                  radopen(null,"Window1");
                  //Cancel the postback
                  return false;
              }
          }

 <telerik:RadMenu ID="RadMenu1" runat="server" orientation="Horizontal" Skin="Windows7" OnClientItemClicking="clickHandler"
                 
                EnableRoundedCorners="True" EnableShadows="True" Height="39px"   Width="100%"
                CausesValidation="False">
                <Items>
                <telerik:RadMenuItem runat="server" Text="Home" ImageUrl="~/Images/Home.png"
                        NavigateUrl="~/frm_HomePage.aspx">
                         
                    </telerik:RadMenuItem>
                    
                                     
                    <telerik:RadMenuItem runat="server" Text="Login" ImageUrl="~/Images/Unlock.png" PostBack="False"    Height="35px"
                        NavigateUrl="">
                         <Items>
                          <telerik:RadMenuItem runat="server" Text=" Driver Login" Value="Login"
                                NavigateUrl="~/frm_DriversLogin.aspx" ImageUrl="~/Images/Users-2.png" Height="35px">
                            </telerik:RadMenuItem>
                           </Items>
                    </telerik:RadMenuItem>
                   <telerik:RadMenuItem runat="server" Text="Trip Information" PostBack="False"
                        ImageUrl="~/Images/Users-Details.png" >
                        <Items>
                            
                            <telerik:RadMenuItem runat="server" NavigateUrl="~/frm_RouteDetails.aspx"
                                Text="View/Edit Trips" Value="View Trips" ImageUrl="~/Images/Worker-Edit.png" Height="35px">
                            </telerik:RadMenuItem>
                                                                             </Items>
                    </telerik:RadMenuItem>
                     <telerik:RadMenuItem runat="server" Text="Break" PostBack="False"  
                           ImageUrl="~/Images/ClockNew.png" >
                        <Items>
                        <telerik:RadMenuItem runat="server" Text="LunchBreak"   Target="_blank"
                                Value="Lunch Break" ImageUrl="~/Images/Worker-Time.png"  Height="35px">
                            </telerik:RadMenuItem>
                            
                            <telerik:RadMenuItem runat="server" Text="Break1"  Target="_blank"
                                Value="Break 1" ImageUrl="~/Images/Worker-Time.png" Height="35px">
                                
                            </telerik:RadMenuItem>
                             <telerik:RadMenuItem runat="server" Text="Break2"  Target="_blank"
                                Value="Break 2" ImageUrl="~/Images/Worker-Time.png" Height="35px">
                                
                            </telerik:RadMenuItem>
                             <telerik:RadMenuItem runat="server" Text="Break3"  Target="_blank"
                                Value="Break 3" ImageUrl="~/Images/Worker-Time.png" Height="35px">
                                
                            </telerik:RadMenuItem>
                             </Items>
                    </telerik:RadMenuItem>
                    </Items>
                    
                    </telerik:RadMenu>
                  <telerik:RadWindowManager ID=RadWindowManager1 runat=server>   
       <Windows>  
           <telerik:RadWindow ID=Window1 runat=server NavigateUrl="frm_BreakTime.aspx" />  
       </Windows>  
   </telerik:RadWindowManager>  


The Run time error I am getting.......

Microsoft JScript runtime error: 'item.Text' is null or not an object

Thanks


Shinu
Top achievements
Rank 2
 answered on 12 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?