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.
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!
<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!
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>
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?
Hi,
This is really needed, the RadCombobox already has such a feature.
Marc
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)