Skip to content

Commit a0388f6

Browse files
committed
docs: fix malformed code block
1 parent 3f7711b commit a0388f6

18 files changed

+434
-457
lines changed

controls/treeview/application-scenarios/data-binding/tutorial-on-using-databindings-to-create-a-hiearchical-treeview.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,43 @@ The following tutorial demonstrates how DataBindings can be used to map data ind
1919

2020
![RadTreeView Tutorial](images/treeview_databindingtutorial01.png)
2121

22-
1. In a new AJAX-Enabled Web Application, drop a **RadTreeView** onto the default form.
22+
- In a new AJAX-Enabled Web Application, drop a **RadTreeView** onto the default form.
2323

24-
1. Locate the "Database.mdb" Access database in the RadControls for ASP.NET AJAX suiteversion installation directory under \Live Demos\App_Data. The typical path is something like the following: \Telerik\RadControls for ASPNET <current version>\Live Demos\App_Data\Database.mdb
24+
- Locate the "Database.mdb" Access database in the RadControls for ASP.NET AJAX suiteversion installation directory under \Live Demos\App_Data. The typical path is something like the following: \Telerik\RadControls for ASPNET <current version>\Live Demos\App_Data\Database.mdb
25+
26+
- Drag the "Database.mdb" file to the project in the Solution Explorer.
2527

26-
1. Drag the "Database.mdb" file to the project in the Solution Explorer.
2728
![RadTreeView Getting Started](images/treeview_gettingstarted02.png)
2829

29-
1. Open the [Smart Tag]({%slug treeview/design-time/smart-tag%}) and set the **Skin** to **Vista** from the drop down list. Then select **<New data source...>** from the **Choose Data Source** drop down list. *This step will display the Data Source Configuration Wizard.*
30+
- Open the [Smart Tag]({%slug treeview/design-time/smart-tag%}) and set the **Skin** to **Vista** from the drop down list. Then select **<New data source...>** from the **Choose Data Source** drop down list. *This step will display the Data Source Configuration Wizard.*
31+
3032
![RadTreeView Getting Started](images/treeview_gettingstarted03.png)
3133

32-
1. In the Data Source Configuration Wizard, "Choose a Data Source Type" page, select the **Access Database** icon and click the **OK** button. *This step will display the Configure Data Source Wizard.*
34+
- In the Data Source Configuration Wizard, "Choose a Data Source Type" page, select the **Access Database** icon and click the **OK** button. *This step will display the Configure Data Source Wizard.*
35+
3336
![RadTreeView Getting Started](images/treeview_gettingstarted04.png)
3437

35-
1. In the "Choose a Database" page, Microsoft Access Data File text box enter "~/Database.mdb". Click the **Next** button to continue.
38+
- In the "Choose a Database" page, Microsoft Access Data File text box enter "~/Database.mdb". Click the **Next** button to continue.
39+
3640
![RadTreeView Getting Started](images/treeview_gettingstarted05.png)
3741

38-
1. In the "Configure the Select Statement" page of the wizard, choose "Items" from the drop down list. In the Columns area check the "*" to include all columns. Click the **Next** button.
42+
- In the "Configure the Select Statement" page of the wizard, choose "Items" from the drop down list. In the Columns area check the "*" to include all columns. Click the **Next** button.
43+
3944
![RadTreeView Tutorial](images/treeview_databindingtutorial02.png)
4045

41-
1. In the Solution Explorer, drag two icon images files to the project. For the purposes of this example the files are named "folderclosed.ico" and "folderopen.ico".
46+
- In the Solution Explorer, drag two icon images files to the project. For the purposes of this example the files are named "folderclosed.ico" and "folderopen.ico".
4247

43-
1. In the Properties Window set **DataFieldID** to "ItemID" and the **DataFieldParentID** to "ParentID".
48+
- In the Properties Window set **DataFieldID** to "ItemID" and the **DataFieldParentID** to "ParentID".
4449

45-
1. Open the RadTreeView Smart Tag and select the **Edit RadTreeView DataBindings** link. *This step will display the **NavigationItemBinding Collection Editor**
50+
- Open the RadTreeView Smart Tag and select the **Edit RadTreeView DataBindings** link. *This step will display the **NavigationItemBinding Collection Editor**
4651

47-
1. In the **NavigationItemBinding Collection Editor** click the Add button four times to create four **RadTreeNodeBinding** objects. Set the properties for the RadTreeNodeBinding objects in order as follows:
52+
- In the **NavigationItemBinding Collection Editor** click the Add button four times to create four **RadTreeNodeBinding** objects. Set the properties for the RadTreeNodeBinding objects in order as follows:
4853
* **TextField**: "Name", **ValueField**: "ItemID".
4954
* **Depth**: 0, **HoveredImageUrl**: "folderopen.ico", **ImageUrl**: "folderclosed.ico", **TextField**: "Name".
5055
* **Depth**: 1, **HoveredImageUrl**: "folderopen.ico", **ImageUrl**: "folderclosed.ico", **TextField**: "Name".
5156
* **Depth**: 4, **TextField**: "Name", **ToolTipField**: "Size".The ASP.NET markup should look like the example below:
52-
````ASPNET
57+
58+
````ASPNET
5359
<telerik:RadTreeView RenderMode="Lightweight" ID="RadTreeView1" runat="server" DataSourceID="AccessDataSource1"
5460
DataFieldID="ItemID" DataFieldParentID="ParentID" LoadingStatusPosition="BeforeNodeText">
5561
<DataBindings>
@@ -65,6 +71,6 @@ The following tutorial demonstrates how DataBindings can be used to map data ind
6571

6672

6773

68-
1. Click the OK button to close the **NavigationItemBinding Collection Editor.**
74+
- Click the OK button to close the **NavigationItemBinding Collection Editor.**
6975

70-
1. Press **F5** to run the application. Move the mouse over first and second level nodes to observe the image change. Hover the mouse above the fourth level nodes to observe the size displayed in the tool tip.
76+
- Press **F5** to run the application. Move the mouse over first and second level nodes to observe the image change. Hover the mouse above the fourth level nodes to observe the size displayed in the tool tip.

controls/treeview/application-scenarios/general/setting-additional-properties-to-the-node-in-the-web-service.md

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,24 @@ public class RadTreeNodeData : ControlItemData
3535
}
3636
````
3737

38-
39-
4038
So, these are the only properties you can set to the child nodes added from Web Service.
4139

4240
Imagine that you need to set a property that is not available in the **RadTreeNodeData** class - e.g. ToolTip. There are two approaches to do this:
4341

4442
## First Approach - using a custom class
4543

46-
1. Create a class that inherits the **RadTreeNodeData** class and add the **ToolTop** property to it:
47-
````C#
44+
- Create a class that inherits the **RadTreeNodeData** class and add the **ToolTop** property to it:
45+
46+
````C#
4847
public class CustomRadTreeNodeData : RadTreeNodeData
4948
{
5049
public string ToolTip;
5150
}
5251
````
5352

53+
- Define the **WebMethod** as follows:
5454

55-
56-
2. Define the **WebMethod** as follows:
57-
````C#
55+
````C#
5856
[WebMethod]
5957
public CustomRadTreeNodeData[] GetNodesWithToolTips()
6058
{
@@ -72,9 +70,7 @@ public CustomRadTreeNodeData[] GetNodesWithToolTips()
7270
}
7371
````
7472

75-
76-
77-
3. Set the tooltip of the node in the [OnClientNodeDataBound]({%slug treeview/client-side-programming/events/onclientnodedatabound%}) event:
73+
- Set the tooltip of the node in the [OnClientNodeDataBound]({%slug treeview/client-side-programming/events/onclientnodedatabound%}) event:
7874

7975
````JavaScript
8076
function OnClientNodeDataBoundHandler(sender, e) {
@@ -83,23 +79,37 @@ function OnClientNodeDataBoundHandler(sender, e) {
8379
}
8480
````
8581

86-
87-
8882
Here is the JSON output for the first child node:
8983

9084
````JavaScript
91-
{"**type":"CustomRadTreeNodeData","ToolTip":"Tooltip for node 1","ExpandMode":0,"NavigateUrl":"","PostBack"
92-
:true,"CssClass":"","DisabledCssClass":"","SelectedCssClass":"","ContentCssClass":null,"HoveredCssClass"
93-
:"","ImageUrl":"","HoveredImageUrl":null,"DisabledImageUrl":"","ExpandedImageUrl":"","ContextMenuID"
94-
:null,"Text":"node 1","Value":"","Enabled":true,"Attributes":{}}
85+
{
86+
"**type": "CustomRadTreeNodeData",
87+
"ToolTip": "Tooltip for node 1",
88+
"ExpandMode": 0,
89+
"NavigateUrl": "",
90+
"PostBack": true,
91+
"CssClass": "",
92+
"DisabledCssClass": "",
93+
"SelectedCssClass": "",
94+
"ContentCssClass": null,
95+
"HoveredCssClass": "",
96+
"ImageUrl": "",
97+
"HoveredImageUrl": null,
98+
"DisabledImageUrl": "",
99+
"ExpandedImageUrl": "",
100+
"ContextMenuID": null,
101+
"Text": "node 1",
102+
"Value": "",
103+
"Enabled": true,
104+
"Attributes": {}
105+
}
95106
````
96107

97-
98-
99108
## Second approach - using the Attributes collection
100109

101-
1. Add the ToolTip custom attribute:
102-
````C#
110+
- Add the ToolTip custom attribute:
111+
112+
````C#
103113
[WebMethod]
104114
public RadTreeNodeData[] GetNodesWithToolTips()
105115
{
@@ -117,9 +127,7 @@ public RadTreeNodeData[] GetNodesWithToolTips()
117127
}
118128
````
119129

120-
121-
122-
2. Set the tooltip of the node in the [OnClientNodeDataBound]({%slug treeview/client-side-programming/events/onclientnodedatabound%}) event:
130+
- Set the tooltip of the node in the [OnClientNodeDataBound]({%slug treeview/client-side-programming/events/onclientnodedatabound%}) event:
123131

124132
````JavaScript
125133
function OnClientNodeDataBoundHandler(sender, e) {
@@ -128,19 +136,33 @@ function OnClientNodeDataBoundHandler(sender, e) {
128136
}
129137
````
130138

131-
132-
133139
Here is the JSON output for the first child node:
134140

135141
````JavaScript
136-
{"**type":"Telerik.Web.UI.RadTreeNodeData","ExpandMode":0,"NavigateUrl":"","PostBack":true,"CssClass"
137-
:"","DisabledCssClass":"","SelectedCssClass":"","ContentCssClass":null,"HoveredCssClass":"","ImageUrl"
138-
:"","HoveredImageUrl":null,"DisabledImageUrl":"","ExpandedImageUrl":"","ContextMenuID":null,"Text":"node
139-
1","Value":"","Enabled":true,"Attributes":{"ToolTip":"new tooltip for node 1"}}
142+
{
143+
"**type": "Telerik.Web.UI.RadTreeNodeData",
144+
"ExpandMode": 0,
145+
"NavigateUrl": "",
146+
"PostBack": true,
147+
"CssClass": "",
148+
"DisabledCssClass": "",
149+
"SelectedCssClass": "",
150+
"ContentCssClass": null,
151+
"HoveredCssClass": "",
152+
"ImageUrl": "",
153+
"HoveredImageUrl": null,
154+
"DisabledImageUrl": "",
155+
"ExpandedImageUrl": "",
156+
"ContextMenuID": null,
157+
"Text": "node 1",
158+
"Value": "",
159+
"Enabled": true,
160+
"Attributes": {
161+
"ToolTip": "new tooltip for node 1"
162+
}
163+
}
140164
````
141165

142-
143-
144166
# See Also
145167

146168
* [Web Service Binding]({%slug treeview/load-on-demand/web-service-binding%})

controls/treeview/context-menus/tutorial-on-creating-a-context-menu-at-design-time.md

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,48 @@ position: 1
1010

1111
# Tutorial on Creating a Context Menu at Design Time
1212

13-
14-
15-
##
16-
1713
The following tutorial demonstrates how to build and attach Context Menus to **RadTreeNodes**. The tutorial also shows how to respond to Context Menu clicks both from the server and client sides.
1814

19-
20-
2115
![RadTreeView Context Menu Design Time](images/treeview_contextmenudesigntime01.png)
2216

23-
1. Add a **RadTreeView** control to a new web page.
17+
- Add a **RadTreeView** control to a new web page.
18+
19+
- In the Properties Window, click the **ContextMenus** property ellipses button. *This step will display the RadTreeViewContextMenu Collection Editor dialog.*
2420

25-
1. In the Properties Window, click the **ContextMenus** property ellipses button. *This step will display the RadTreeViewContextMenu Collection Editor dialog.*
21+
- Click the **Add** button to add a new **RadTreeViewContextMenu** item.
2622

27-
1. Click the **Add** button to add a new **RadTreeViewContextMenu** item.
23+
- In the properties window on the right side of the dialog, set the **ID** property to "MyContextMenu". Locate the **Items** property and click the ellipses button. *This step will display the RadContextMenu Item Builder dialog.*
2824

29-
1. In the properties window on the right side of the dialog, set the **ID** property to "MyContextMenu". Locate the **Items** property and click the ellipses button. *This step will display the RadContextMenu Item Builder dialog.*
3025
![RadTreeView Context Menu Design Time](images/treeview_contextmenudesigntime02.png)
3126

32-
1. In the **RadContextMenuItem Builder** dialog click the **Add Root Item** button twice, select the second item and click the **Add Child Item** button twice.
27+
- In the **RadContextMenuItem Builder** dialog click the **Add Root Item** button twice, select the second item and click the **Add Child Item** button twice.
28+
3329
![RadTreeView Context Menu Design Time](images/treeview_contextmenudesigntime03.png)
3430

35-
1. Select the first item and set the **Text** property of the two root Items to "Edit" and "Add". Set the **Text** property of "Add" child Items to "Before" and "After". The **RadContextMenu Item Builder** dialog should look something like the screenshot below.
31+
- Select the first item and set the **Text** property of the two root Items to "Edit" and "Add". Set the **Text** property of "Add" child Items to "Before" and "After". The **RadContextMenu Item Builder** dialog should look something like the screenshot below.
32+
3633
![RadTreeView Context Menu Design Time](images/treeview_contextmenudesigntime04.png)
3734

38-
1. Click **OK** to close the **RadContextMenu Item Builder** dialog.
35+
- Click **OK** to close the **RadContextMenu Item Builder** dialog.
3936

40-
1. Click **OK** to close the **RadTreeViewContextMenu Collection Editor** dialog.
37+
- Click **OK** to close the **RadTreeViewContextMenu Collection Editor** dialog.
4138

42-
1. Open the RadTreeView Smart Tag and click the **Build RadTreeView** link. *This step will open the RadTreeView Item Builder.*
39+
- Open the RadTreeView Smart Tag and click the **Build RadTreeView** link. *This step will open the RadTreeView Item Builder.*
40+
41+
- Click the **Add Root Node** button three times to create three **RadTreeNode** objects. Set the **ContextMenuID** property for all three items to "MyContextMenu".
4342

44-
1. Click the **Add Root Node** button three times to create three **RadTreeNode** objects. Set the **ContextMenuID** property for all three items to "MyContextMenu".
4543
![RadTreeView Context Menu Design Time](images/treeview_contextmenudesigntime06.png)
4644

47-
1. Click the events button the Properties Window for the RadTreeView. Locate the **ContextMenuItemClick** event and double-click. *This step will create a ContextMenuItemClick event handler and display the code view for it.*
45+
- Click the events button the Properties Window for the RadTreeView. Locate the **ContextMenuItemClick** event and double-click. *This step will create a ContextMenuItemClick event handler and display the code view for it.*
46+
4847
![RadTreeView Context Menu Design Time](images/treeview_contextmenudesigntime05.png)
4948

50-
1. In the **ContextMenuItemClick** event handler add the code below. *The code here handles the "Add Before" and "Add After" menu items. The "Edit" item will be handled on the client side in the following steps. Also notice the reference to **Telerik.Web.UI** used to support the **RadTreeNode** type.
51-
````C#
52-
using System;using Telerik.Web.UI;
49+
- In the **ContextMenuItemClick** event handler add the code below. *The code here handles the "Add Before" and "Add After" menu items. The "Edit" item will be handled on the client side in the following steps. Also notice the reference to **Telerik.Web.UI** used to support the **RadTreeNode** type.
50+
51+
````C#
52+
using System;
53+
using Telerik.Web.UI;
54+
5355
namespace RadTreeView_ContextMenu
5456
{
5557
public partial class _Default : System.Web.UI.Page
@@ -59,7 +61,6 @@ namespace RadTreeView_ContextMenu
5961
if (e.MenuItem.Text == "Before")
6062
{
6163
e.Node.InsertBefore(new RadTreeNode("New Node Before"));
62-
6364
}
6465
else if (e.MenuItem.Text == "After")
6566
{
@@ -69,9 +70,10 @@ namespace RadTreeView_ContextMenu
6970
}
7071
}
7172
````
72-
````VB.NET
73+
````VB
7374
Imports System
7475
Imports Telerik.Web.UI
76+
7577
Namespace RadTreeView_ContextMenu
7678
Partial Public Class _Default
7779
Inherits System.Web.UI.Page
@@ -86,30 +88,30 @@ Namespace RadTreeView_ContextMenu
8688
End Namespace
8789
````
8890

91+
- In the Properties Window set the **RadTreeView** **OnClientContextMenuItemClicking** property to "clientContextMenuItemClicking".
8992

90-
1. In the Properties Window set the **RadTreeView** **OnClientContextMenuItemClicking** property to "clientContextMenuItemClicking".
93+
- In the ASP.NET markup for the page add the script code below. This code gets references to the Context Menu Item that was clicked and the Node for that Context Menu Item. If the Menu Item text is "Edit" then the Node is put into editing state. **set_cancel()** is called to prevent the Postback. If you don't prevent the postback the refresh will end the Node editing, subsequently producing the following visual effect: Node opens for editing momentarily, then closes. Finally, the Menu is closed calling its hide() function.
9194

92-
1. In the ASP.NET markup for the page add the script code below. This code gets references to the Context Menu Item that was clicked and the Node for that Context Menu Item. If the Menu Item text is "Edit" then the Node is put into editing state. **set_cancel()** is called to prevent the Postback. If you don't prevent the postback the refresh will end the Node editing, subsequently producing the following visual effect: Node opens for editing momentarily, then closes. Finally, the Menu is closed calling its hide() function.
93-
````ASPNET
95+
````ASP.NET
9496
<telerik:RadTreeView RenderMode="Lightweight" ID="RadTreeView1"
95-
runat="server"
96-
OnClientContextMenuItemClicking="clientContextMenuItemClicking"
97-
Skin="Default">
97+
runat="server"
98+
OnClientContextMenuItemClicking="clientContextMenuItemClicking"
99+
Skin="Default">
98100
</telerik:RadTreeView>
99101
````
100-
````JavaScript
102+
103+
````JavaScript
101104
function clientContextMenuItemClicking(sender, eventArgs) {
102-
var node = eventArgs.get_node();
103-
var item = eventArgs.get_menuItem();
104-
if (item.get_text() == "Edit") {
105-
node.startEdit();
106-
// cancel the server event
107-
eventArgs.set_cancel(true);
108-
// close the menu
109-
item.get_menu().hide();
110-
}
105+
var node = eventArgs.get_node();
106+
var item = eventArgs.get_menuItem();
107+
if (item.get_text() == "Edit") {
108+
node.startEdit();
109+
// cancel the server event
110+
eventArgs.set_cancel(true);
111+
// close the menu
112+
item.get_menu().hide();
113+
}
111114
}
112115
````
113116

114-
115-
1. Press F5 to run the application. Click the "Add Before" and "Add After" Menu Items. Also notice that clicking the "Edit" Menu Item puts the Node into edit mode and that no postback occurs.
117+
- Press F5 to run the application. Click the "Add Before" and "Add After" Menu Items. Also notice that clicking the "Edit" Menu Item puts the Node into edit mode and that no postback occurs.

0 commit comments

Comments
 (0)