Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
99 views

In a RadTreeList, when a user clicks on a checkbox, I want to check its child nodes, but only ones that are enabled. The issue is that there is no API to determine if a node is enabled. I’m have been trying with JQuery selector, so far unsuccessfully.

I include the code as follows.



<telerik:RadTreeList  ID="rtlFolderView" runat="server" OnNeedDataSource="rtlFolderView_NeedDataSource" Width="100%" Height="100%"
ParentDataKeyNames="ParentDocumentFolderId" DataKeyNames="DocumentFolderId" AllowPaging="false" AllowMultiItemSelection="true" 
                            OnItemDataBound="rtlFolderView_ItemDataBound" AutoGenerateColumns="false" AllowSorting="true" ExpandCollapseMode="Server">
                            <ClientSettings>
                                <Selecting AllowItemSelection="true" />
                                <ClientEvents OnItemSelected="clientNodeChecked"  />
</ClientSettings>

//javascript.
function clientNodeChecked(sender, eventArgs) {
                var dataItem = eventArgs.get_item();
                var childNodes = dataItem.get_childItems();
                if (childNodes === null) {
return;
                }
                var isChecked = dataItem.get_selected();
                UpdateAllChildren(childNodes, isChecked);
            }

            function UpdateAllChildren(nodes, checked) {
                var i = 0;
var nodeCount = nodes.length;
                for (i = 0; i < nodeCount; i++) {
                    //console.log(nodes[i]._element.childNodes);
                    var found = false;
                    //$(nodes[i]._element.childNodes).each(function (index, elmnt) {
                        //console.log((elmnt));
                        //if (index > 0 &&  $(elmnt).attr('class').indexOf('aspNetDisabled') >= 0) {
                        //if (el.length > 0) {
                        //    found = true;
                        //    console.log(el);
                        //}
                    //});
                    //var chk = $(nodes[i]).find('input[type=checkbox]').first();
                    //var disabled = $(chk).attr('disabled');
if (!found) {
                            nodes[i].set_selected(checked);
                    }
                }
            }

 

Any help would be appreciated.

Rumen
Telerik team
 answered on 27 Jun 2019
1 answer
97 views

Hi,

I have the following code:

<script>
Sys.Application.add_load(FormLoad) 
 
 function FormLoad()
 
  {
 
    HideOpportunity(true);
  
   
 
    function HideOpportunity(sender, eventArgs) {
  var x = document.getElementById("OpportunitySetUp");
   if (x.style.display === "none") {
    x.style.display = "block";
  } else {
    x.style.display =  "none";
  }
       
    var ForecastingGrid = document.getElementById("ForecastingRevenue");
   
     ForecastingGrid.style.display = "none";
 
     
    var RevenueForecasting  = $sq("[id$='cboRevenueForecasting']").val();
     
     if (RevenueForecasting == "Manual Phasing") {
        ForecastingGrid.style.display = "block";
    } else {
        ForecastingGrid.style.display = "none";
    }
     
  }
  </script>

 

This seems to work perfectly up until the combobox value is selected. The code only seems to execture and show the "ForcastingRevenue" section when "autopostback = true" is added to the combobox properties but this is useless as it refreshes the page of the form, resetting the other .style.display element of "OpportunitySetUp".

Is there a way to have the form load without adding in the autopostback property? I'm using the Cora Sequence framework if that is any use. 

 

Thanks for any help!

Rumen
Telerik team
 answered on 27 Jun 2019
1 answer
96 views
Hi,

I have the following code:

<script>
Sys.Application.add_load(FormLoad)
  
 function FormLoad()
  
  {
  
    HideOpportunity(true);
  }
    
  
    function HideOpportunity(sender, eventArgs) {
  var x = document.getElementById("OpportunitySetUp");
   if (x.style.display === "none") {
    x.style.display = "block";
  } else {
    x.style.display =  "none";
  }
        
    var ForecastingGrid = document.getElementById("ForecastingRevenue");
    
     ForecastingGrid.style.display = "none";
  
      
    var RevenueForecasting  = $sq("[id$='cboRevenueForecasting']").val();
      
     if (RevenueForecasting == "Manual Phasing") {
        ForecastingGrid.style.display = "block";
    } else {
        ForecastingGrid.style.display = "none";
    }
      
  }
  </script>

 

When the form loads, the code works, everything is hidden. When i click on the "Opportunity Set Up" the first block shows.

Then within this "Opportunity Set Up" there's a comboBox, and if the value "Manual Phasing" is selected, the 2nd section "ForecastingGrid" shows.

This seems to work perfectly up until the combobox value is selected. The code only seems to execute and show the "ForcastingRevenue" section when "autopostback = true" is added to the combobox properties but this is useless as it refreshes the page of the form, resetting the other .style.display element of "OpportunitySetUp".

Is there a way to have the form load without adding in the autopostback property? I'm using the Cora Sequence framework if that is any use. 

Thanks for any help!

Rumen
Telerik team
 answered on 27 Jun 2019
10 answers
168 views

Hi Rumen,

I found one more issue in rad editor after taking latest version 2018.2.710.45 telerik dll.
While i trying to upload any image from rad editor tools and second time trying to edit the editor,Editor tools not coming.
 It was working fine in version 2013.2.717.45 but it is not working in 2018.2.710.45(which i upgrade) and also not working with latest version 2019.1.215.

Steps to reproduce
1.click on editor, it will be edited and rad tools will come on the top
2.try to add image from tools(insert/cancel from popup).
3.click outside the editor.
4.again click on editor it will be edited but toolbar  is not showing.

when i am using set_useClassicDialogs(true) then only it happens.

If i passed false then its working fine.

 

code given below.

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Metricaadmin.WebForm1" %>

<html>
<head>

    <script type="text/javascript" src="js/jquery-2.2.4.min.js"></script>

    <style>
        .annotation {
            border: 1px solid red;
            width: 600px;
            position: relative;
        }
    </style>
</head>

<body>


    <script type="text/javascript">
        var isEditing = false;
        var currentEditor;

        function setEditorVisible(toShow) {
            var editorWrapper = $get("editorWrapper");

            if (toShow) {
                editorWrapper.style.visibility = "visible";
                editorWrapper.style.position = "";
            }
            else {
                editorWrapper.style.visibility = "hidden";
                editorWrapper.style.position = "absolute";
            }
        }

        function editAnnotation(target, ev) {
            //Cancel the event - prevent it to reach body    
            //TODO: Add more stuff to cancel it in Mozilla    
            ev.cancelBubble = true;
            ev.returnValue = false;

            //Check if already editing    
            if (isEditing) return;

            var editorWrapper = $get("editorWrapper");
            var editor = $find("<%=RadEditor1.ClientID %>");

            //Position the editor next to the div, hide the div    
            var bounds = $telerik.getBounds(target);

            //Do not set the size explicitly anymore - witn new version when using abs positioning    
            editor.setSize(bounds.width, bounds.height);

            target.parentNode.insertBefore(editorWrapper, target);

            setEditorVisible(true);

            currentEditor = editor;


            target.style.display = "none";

            //set editor content    
            editor.set_html(target.innerHTML);

            //Prevent from moving the editor to another annotation while editing current one    
            isEditing = true;

            setTimeout("showEditor();", 1000);
        }

        function showEditor() {
            currentEditor.onParentNodeChanged();
        }


    </script>

    <form runat="server">

        <asp:ScriptManager ID="s1" runat="server"></asp:ScriptManager>
        <script type="text/javascript">
            var currentEditorObject = null;
            var focusEditor = null;

            function e1_ClientLoad(editor, eventArgs) {
                editor.set_useClassicDialogs(true);
                editor.removeShortCut("InsertTab");
                currentEditorObject = editor;
            }

            function hideEditor() {
                if (isEditing) {

                    var editorWrapper = $get("editorWrapper");

                    var parent = editorWrapper.parentElement;
                    while (parent.style.position != "absolute") {
                        parent = parent.parentElement;
                    }

                    var st = parent.scrollTop;
                    var sl = parent.scrollLeft;



                    var target = $($(editorWrapper).parent()).children().first();
                    var newVal = currentEditorObject.get_html(true);

                    $(target).next().val(newVal); //hidden input tag
                    $(target).html(newVal); //anchor tag
                    setEditorVisible(false);
                    $(target).show();
                    target.focus();

                    parent.scrollTop = st;
                    parent.scrollLeft = sl;
                }

                isEditing = false;
            }
            ////MET-8615
            //Radeditor edit error after telerik upgrade 
            //hot fix from  telerik website
            Telerik.Web.UI.Editor.Utils.isWindowDestroyed = function (window) {
                var doc;
                try {
                    doc = window.document;
                } catch (e) {
                    return true;
                }
                if (!doc) {
                    return true;
                }
                return !doc.defaultView && !doc.parentWindow;
            }
        </script>
        <div id="tempEditorWrapper" style="visibility: hidden; position: absolute; top: 0px; z-index: 10002" class="tempeditorWrapper">

        <div id="editorWrapper" style="visibility: hidden; position: absolute; top: 0px; z-index: 10002" onclick="hideEditor();" class="editorWrapper">

            <div class="editorBackground"></div>

            <div class="editorBorder">
            <telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="e1_ClientLoad" ToolbarMode="ShowOnFocus" 
                Height="300px" EditModes="Design">
                <Tools>
                    <telerik:EditorToolGroup>
                        <telerik:EditorTool Name="AjaxSpellCheck" />
                        <telerik:EditorTool Name="Cut" />
                        <telerik:EditorTool Name="Copy" />
                        <telerik:EditorTool Name="PasteStrip" />
                        <telerik:EditorTool Name="Bold" />
                        <telerik:EditorTool Name="Italic" />
                        <telerik:EditorTool Name="Underline" />
                        <telerik:EditorTool Name="Superscript" />
                        <telerik:EditorTool Name="Subscript" />
                        <telerik:EditorTool Name="FormatStripper" />
                        <telerik:EditorTool Name="JustifyLeft" />
                        <telerik:EditorTool Name="JustifyRight" />
                        <telerik:EditorTool Name="JustifyCenter" />
                        <telerik:EditorTool Name="JustifyFull" />

                        <telerik:EditorTool Name="InsertLink" />
                        <telerik:EditorTool Name="InsertSnippet" />
                        <telerik:EditorTool Name="ImageManager" />
                        <telerik:EditorTool Name="InsertTable" />
                        <telerik:EditorTool Name="ApplyClass" />
                        <telerik:EditorTool Name="InsertSymbol" />
                        <telerik:EditorTool Name="InsertParagraph" />
                        <telerik:EditorTool Name="InsertOrderedList" />
                        <telerik:EditorTool Name="InsertUnorderedList" />
                    </telerik:EditorToolGroup>
                </Tools>
                <Modules>
                    <telerik:EditorModule Name="RadEditorStatistics" />
                </Modules>
                <DocumentManager SearchPatterns="*.*" ViewPaths="~/" UploadPaths="~/" />
                <ImageManager ViewPaths="~/" UploadPaths="~/" />
                <CssFiles>
                    <telerik:EditorCssFile Value="~/styles/editor.css" />
                </CssFiles>
                <Content>   
       
       
                </Content>
            </telerik:RadEditor>
        </div>
            </div>
            </div>

        click to edit an annotation.<br />
        To Cancel editing - double-click outside any div, in the BODY<br />
        To save the changes to the edited DIV click on Save button     
        <br />
        <br />
        Annotation 1    
        <div class="annotation" onclick="editAnnotation(this, event)">
            This is sample content     
        </div>


    </form>

</body>
</html>

Rajiv
Top achievements
Rank 1
 answered on 27 Jun 2019
2 answers
107 views

I have a Hierarchy grid with a using a Master TableView and one DetailTable that looks like this

 

<telerik:RadGrid runat="server" ID="PrintRadGrid" OnDetailTableDataBind="PrintRadGrid_DetailTableDataBind"
                                AutoGenerateColumns="false" OnPageIndexChanged="PrintRadGrid_PageIndexChanged" OnPageSizeChanged="PrintRadGrid_PageSizeChanged"
                                GroupPanelPosition="Top" OnUpdateCommand="PrintRadGrid_UpdateCommand" OnInsertCommand="PrintRadGrid_InsertCommand"
                                AllowPaging="true"  OnNeedDataSource="PrintRadGrid_NeedDataSource">
                                <GroupingSettings CollapseAllTooltip="Collapse all groups" />
                                <PagerStyle Mode="NextPrevAndNumeric" />
                                <MasterTableView CommandItemDisplay="Top" DataKeyNames="CaseId_Fk,LatentsId" HierarchyDefaultExpanded="false" RetainExpandStateOnRebind="true">
                                    <Columns>
                                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="PrintsEditCommandColumn"></telerik:GridEditCommandColumn>
                                        <telerik:GridDateTimeColumn DataField="SubmittedDate" HeaderText="Submitted Date" SortExpression="SubmittedDate"
                                            PickerType="DatePicker" EnableTimeIndependentFiltering="true" DataFormatString="{0:MM/dd/yyyy}">
                                        </telerik:GridDateTimeColumn>
                                        <telerik:GridBoundColumn UniqueName="SubmittedBy" HeaderText="Submitted By" DataField="SubmittedBY"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="SubmittedByNoneOCSO" HeaderText="Submitted By None Employee" DataField="SubmittedByNoneOcso"></telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="false">
                                                    <ItemTemplate>
                                                        <asp:Button ID="btnDeleteParent" CssClass="btn btn-xs btn-danger" Text="Delete" runat="server" OnClick="btnDeletePrintParent_Click" OnClientClick="confirmAspButton(this); return false;"></asp:Button>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                    </Columns>
                                    <DetailTables>
                                        <telerik:GridTableView Name="PrintsLiftedGrid" Width="100%" DataKeyNames="LatentsId_FK"
                                             CommandItemDisplay="Top" EnableNoRecordsTemplate="true" HierarchyDefaultExpanded="false">
                                            <NoRecordsTemplate>
                                                <asp:Label ID="Label8" runat="server" CssClass="label" Text="No charges have been added." />
                                            </NoRecordsTemplate>
                                            <Columns>
                                                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                                                 </telerik:GridEditCommandColumn>
                                                <telerik:GridDateTimeColumn DataField="LiftedDate" HeaderText="Lifted Date Date" SortExpression="LiftedDate"
                                                    PickerType="DatePicker" EnableTimeIndependentFiltering="true" DataFormatString="{0:MM/dd/yyyy}">
                                                </telerik:GridDateTimeColumn>
                                                <telerik:GridBoundColumn UniqueName="ExhibitNum" HeaderText="Exhibit Number" DataField="ExhibitNum"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="LocationLifted" HeaderText="Location Lifted" DataField="LocationLifted"></telerik:GridBoundColumn>
                                                <telerik:GridTemplateColumn AllowFiltering="false">
                                                    <ItemTemplate>
                                                        <asp:Button ID="btnDeletePrintChild" CssClass="btn btn-xs btn-danger" Text="Delete" runat="server" OnClick="btnDeletePrintChild_Click" OnClientClick="confirmAspButton(this); return false;"></asp:Button>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                             </Columns>
                                            <CommandItemStyle BackColor="#AfAFa4" Font-Bold="true" Height="50px"
                                                VerticalAlign="Bottom" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                                            <CommandItemTemplate>
                                                <div class="boldLabel"> Prints</div>
                                                <asp:Button runat="server" ID="lbAddPrint" Text="ADD NEW PRINT" CommandName="InitInsert"
                                                    CssClass="rgButtonText" CausesValidation="false" />
                                            </CommandItemTemplate>
                                            <ParentTableRelation>
                                                <telerik:GridRelationFields DetailKeyField="LatentsId_FK" MasterKeyField="LatentsId" />
                                            </ParentTableRelation>
                                        </telerik:GridTableView>

 

In the MasterTable View and the the DetailTable I want to use a web control for Inserting and Updating the records.  I have tried adding this code:

<EditFormSettings UserControlName="SubjectEdit.ascx" EditFormType="WebUserControl" PopUpSettings-Modal="false">
                                                <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                                            </EditFormSettings>

 

Put keep getting this  error :Telerik.Web.UI.GridTableViewCollection must have items of type 'Telerik.Web.UI.GridTableView'. 'EditFormSettings' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

What is the syntax to use the web control page and where within MasterTableView and DetailTableView do I put it?

Perry
Top achievements
Rank 1
 answered on 26 Jun 2019
5 answers
504 views
I have a dropdownlist located inside RadAjax Panel (Build Q4 2006 ) with AutoPostBack option enabled and SelectedIndexChanged event is handled. Whenever loading the page a javascript exception is through "Expected ')'".

The problem is related to the generated Javascript handler added to the dropdownlist "onchange" client event. I have tried to locate a solution for this issue through all threads but couldn't locate anything helpful for this issue.

Here is the aspx markup used by the page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <radA:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="200px" width="300px" ClientIDMode="AutoID" EnableOutsideScripts="True">
            <br />
            <asp:DropDownList ID="ddlItems" runat="server" AutoPostBack="True">
                <asp:ListItem>Item1</asp:ListItem>
                <asp:ListItem>Item2</asp:ListItem>
            </asp:DropDownList>
            <br />
            <br />
            <asp:Label ID="lblTest" runat="server"></asp:Label>
           
        </radA:RadAjaxPanel>
    </div>
    </form>
</body>
</html>



Rumen
Telerik team
 answered on 25 Jun 2019
24 answers
548 views
Hi,

I have ajax.net2 version 1.8.1.0. I want use to this on my asp.net 4.0 site. It work fine with other controls but when I use this with dropdown list I get JS error. Reason it convert ' to &#39;. How can I fix this? 

<select name="ctl00$PageContentPlaceHolder$PageGrid$ctl01$ctl03$ctl01$PageDropDownList" onchange="javascript:setTimeout(&#39;AjaxNS.AR(\&#39;ctl00$PageContentPlaceHolder$PageGrid$ctl01$ctl03$ctl01$PageDropDownList\&#39;,\&#39;\&#39;, 'ctl00_PageContentPlaceHolder_RadAjaxManager1', event)&#39;, 0)" id="ctl00_PageContentPlaceHolder_PageGrid_ctl01_ctl03_ctl01_PageDropDownList" class="csa_textbox" style="width:40px;">
Rumen
Telerik team
 answered on 25 Jun 2019
2 answers
113 views

Hi,

 

This is really needed,  the RadCombobox already has such a feature.

 

Marc

Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
 answered on 25 Jun 2019
1 answer
112 views

I have controller method which looks like this:

[HttpPost]
public IActionResult CreateNew(string Naslov, int KorisnikID, int GrupaID, string Tekst)
{
    //Some code
}

 

Ajax function that is calling this is:

$.ajax({
    type: "POST",
    url: "/Story/CreateNew",
    contentType: "application.json; charset=utf-8",
    dataType: "json",
    data: JSON.stringify({
        "Naslov": $("#Naslov").val(),
        "KorisnikID": @Context.Request.Cookies["kid"],
        "GrupaID": $("#GrupaID").val(),
        "Tekst": $("#Tekst .ql-editor").html()
    }),
    success: function (message) {
        var elements = message.split("-");
 
        if (elements[0] == "success") {
            window.location.href = '/Clanak?ID' + elements[1];
        }
        else {
            alert(message);
        }
    },
    error: function (xhr, status, error) {
        alert(xhr + " " + status + " " + error);
    }
});

 

Method is entered but all parameters are null.

Also when i change it to GET it works (but i need post since i have problem with length of string)

 


Rumen
Telerik team
 answered on 25 Jun 2019
2 answers
163 views
Here's the scenario:  I have a complex work request form.  On this form the user needs to identify how to break out the postage.  The postage may use various mailing methods (first class, second class....) and mail carriers (USPS, UPS....).  So for each postage information, I need to capture the number of pieces, the cost per piece, the mailing method, mail carrier and the total cost.  This information is not to be saved until the user saves the rest of the request form.  Normally I would use javascript and a table to display the data and to be able to add and remove rows until the user hits the "save" button to actually save the information. Then I would go back to server side and update the database.

How do I accomplish this using Telerik controls without using a web service to go back to the database each time I add/update/remove a row? There is no need to go back to the server until the user clicks the "save" button.

thanks on any help you can give me on this.

oliver
Top achievements
Rank 1
 answered on 25 Jun 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?