Skip to content

Commit 78d68a9

Browse files
committed
docs(combobox, dateinput): adjust code blocks and bullets
1 parent 12cf4de commit 78d68a9

File tree

3 files changed

+94
-130
lines changed

3 files changed

+94
-130
lines changed

controls/ajaxpanel/troubleshooting/common-issues.md

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,9 @@ position: 1
1515

1616
Here are some of the common issues one can face when using **RadAjax** .
1717

18-
* [Inline JavaScript in dynamically loaded user controls is missing on the page.](#Problem1)
18+
## Inline JavaScript in dynamically loaded user controls is missing on the page.
1919

20-
* [A control’s skin is not loaded after an AJAX update.](#Problem2)
21-
22-
* [Setting the EventName property in the AJAX settings for the AJAX initiator control does not work.](#Problem3)
23-
24-
* [The loading panel is not displayed if you invoke multiple requests from the same AJAX initiator before the previous request finished.](#Problem4)
25-
26-
* [My page went blank after I fired an event from a dynamically loaded user control.](#Problem5)
27-
28-
* [After postback/AJAX request, my control does not keep its last state.](#Problem6)
29-
30-
* [After dynamically loading a user control, I cannot fire the events of any of its controls.](#Problem7)
31-
32-
* [LoadingPanel is not displayed when dynamically created controls in a user control trigger the AJAXrequest.](#Problem8)
33-
34-
* [I used RadAjax to AJAX-enable controls but they are showing up twice.](#Problem9)
35-
36-
* [UseSubmitBehavior for ASP Button is ignored when the control is AJAX enabled through RadAjaxManager or RadAjaxPanel](#Problem10)
37-
38-
##
39-
40-
1. Problem: Inline JavaScript in dynamically loaded user controls is missing on the page.Solution: Wrap your script block into a **RadScriptBlock**. If the issue persists in your case, you ought to register the script through the **ScriptManager.RegisterStartupScript()** method.
20+
Wrap your script block into a **RadScriptBlock**. If the issue persists in your case, you ought to register the script through the **ScriptManager.RegisterStartupScript()** method.
4121

4222
````ASPNET
4323
<telerik:RadScriptBlock Id="RadScriptBlock1" runat="server">
@@ -47,7 +27,6 @@ Here are some of the common issues one can face when using **RadAjax** .
4727
</telerik:RadScriptBlock>
4828
````
4929

50-
5130
````C#
5231
protected void Page_Load(object sender, EventArgs e)
5332
{
@@ -56,12 +35,13 @@ protected void Page_Load(object sender, EventArgs e)
5635
````
5736
````VB
5837
Protected Sub Page_Load(sender as Object, e as EventArgs) Handles Me.Load
59-
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "dynamicScript", "function doSomething(){alert(1);}")
38+
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "dynamicScript", "function doSomething(){alert(1);}")
6039
End Sub
6140
````
6241

42+
## A control’s skin is not loaded after an AJAX update.
6343

64-
2. Problem: A control’s skin is not loaded after an AJAX update.Solution: This issue usually occurs when a control is displayed after an AJAX update or the skin is changed upon AJAX update. In this case, set the control’s **EnableAjaxSkinRendering** property to **true** on **Page_Load** and after every postback
44+
This issue usually occurs when a control is displayed after an AJAX update or the skin is changed upon AJAX update. In this case, set the control’s **EnableAjaxSkinRendering** property to **true** on **Page_Load** and after every postback
6545

6646
````C#
6747
protected void Page_Load(object sender, EventArgs e)
@@ -75,34 +55,35 @@ Protected Sub Page_Load(sender as Object, e as EventArgs) Handles Me.Load
7555
End Sub
7656
````
7757

78-
7958
For example, if a **RadGrid** control is shown after a partial postback from a button click the **EnableAjaxSkinRendering** property of **RadGrid** should be set to **true** on button click. Also, keep in mind that if there are controls inside the grid, their **EnableAjaxSkinRendering**property should also be set to **true**. The code snippet below demonstrates how to load the skins of **RadGrid** and **RadDateTimePicker** control placed in the **ItemTemplate** of the grid template column after a partial postback.
8059

8160
````C#
8261
protected void Button1_Click(object sender, EventArgs e)
8362
{
84-
RadGrid1.Visible = true;
85-
((RadGrid1.MasterTableView.Items[0] as GridDataItem)["TemplateColumnUniqueName"].FindControl("RadDateTimePicker1") as RadDateTimePicker).Calendar.EnableAjaxSkinRendering = true;
86-
((RadGrid1.MasterTableView.Items[0] as GridDataItem)["TemplateColumnUniqueName"].FindControl("RadDateTimePicker1") as RadDateTimePicker).TimeView.EnableAjaxSkinRendering = true;
87-
((RadGrid1.MasterTableView.Items[0] as GridDataItem)["TemplateColumnUniqueName"].FindControl("RadDateTimePicker1") as RadDateTimePicker).DateInput.EnableAjaxSkinRendering = true;
88-
RadGrid1.EnableAjaxSkinRendering = true;
63+
RadGrid1.Visible = true;
64+
((RadGrid1.MasterTableView.Items[0] as GridDataItem)["TemplateColumnUniqueName"].FindControl("RadDateTimePicker1") as RadDateTimePicker).Calendar.EnableAjaxSkinRendering = true;
65+
((RadGrid1.MasterTableView.Items[0] as GridDataItem)["TemplateColumnUniqueName"].FindControl("RadDateTimePicker1") as RadDateTimePicker).TimeView.EnableAjaxSkinRendering = true;
66+
((RadGrid1.MasterTableView.Items[0] as GridDataItem)["TemplateColumnUniqueName"].FindControl("RadDateTimePicker1") as RadDateTimePicker).DateInput.EnableAjaxSkinRendering = true;
67+
RadGrid1.EnableAjaxSkinRendering = true;
8968
}
9069
````
9170
````VB
9271
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click.
93-
RadGrid1.Visible = True
94-
TryCast(TryCast(RadGrid1.MasterTableView.Items(0), GridDataItem)("TemplateColumnUniqueName").FindControl("RadDateTimePicker1"), RadDateTimePicker).Calendar.EnableAjaxSkinRendering = True
95-
TryCast(TryCast(RadGrid1.MasterTableView.Items(0), GridDataItem)("TemplateColumnUniqueName").FindControl("RadDateTimePicker1"), RadDateTimePicker).TimeView.EnableAjaxSkinRendering = True
96-
TryCast(TryCast(RadGrid1.MasterTableView.Items(0), GridDataItem)("TemplateColumnUniqueName").FindControl("RadDateTimePicker1"), RadDateTimePicker).DateInput.EnableAjaxSkinRendering = True
97-
RadGrid1.EnableAjaxSkinRendering = True
72+
RadGrid1.Visible = True
73+
TryCast(TryCast(RadGrid1.MasterTableView.Items(0), GridDataItem)("TemplateColumnUniqueName").FindControl("RadDateTimePicker1"), RadDateTimePicker).Calendar.EnableAjaxSkinRendering = True
74+
TryCast(TryCast(RadGrid1.MasterTableView.Items(0), GridDataItem)("TemplateColumnUniqueName").FindControl("RadDateTimePicker1"), RadDateTimePicker).TimeView.EnableAjaxSkinRendering = True
75+
TryCast(TryCast(RadGrid1.MasterTableView.Items(0), GridDataItem)("TemplateColumnUniqueName").FindControl("RadDateTimePicker1"), RadDateTimePicker).DateInput.EnableAjaxSkinRendering = True
76+
RadGrid1.EnableAjaxSkinRendering = True
9877
End Sub
9978
````
10079

80+
## Setting the EventName property in the AJAX settings for the AJAX initiator control does not work.
10181

82+
The **EventName** property is obsolete for **RadAjax** . If your logic strongly relies on it, you should use an **asp:UpdatePanel** toAJAX-enable the controls instead of **RadAjax** . Another option is to wrap the updated control in a**RadAjaxPanel** instead of using the **RadAjaxManager** to AJAX-enable it. Then on certain client-side events of the AJAX initiator, invoke AJAX for the corresponding **RadAjaxPanel** manually. See the sample in[this help article]({%slug ajaxpanel/overview%}) for more information.
10283

103-
3. Problem: Setting the **EventName** property in the AJAX settings for the AJAX initiator control does not work.Solution: The **EventName** property is obsolete for **RadAjax** . If your logic strongly relies on it, you should use an **asp:UpdatePanel** toAJAX-enable the controls instead of **RadAjax** . Another option is to wrap the updated control in a**RadAjaxPanel** instead of using the **RadAjaxManager** to AJAX-enable it. Then on certain client-side events of the AJAX initiator, invoke AJAX for the corresponding **RadAjaxPanel** manually. See the sample in[this help article]({%slug ajaxpanel/overview%}) for more information.
84+
## The loading panel is not displayed if you invoke multiple requests from the same AJAX initiator before the previous request finished.
10485

105-
4. Problem: The loading panel is not displayed if you invoke multiple requests from the same AJAX initiator before the previous request finished.Solution: Modify your code to handle the **RadAjaxManager/RadAjaxPanel OnRequestStart** client-side event.
86+
Modify your code to handle the **RadAjaxManager/RadAjaxPanel OnRequestStart** client-side event.
10687

10788
````JavaScript
10889
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
@@ -111,28 +92,38 @@ End Sub
11192
var obj = Sys.WebForms.PageRequestManager.getInstance();
11293
if (obj.get_isInAsyncPostBack())
11394
obj.abortPostBack();
114-
}
95+
}
11596
</script>
11697
</telerik:RadCodeBlock>
11798
````
11899

100+
## My page went blank after I fired an event from a dynamically loaded user control.
119101

120-
121-
5. Problem: My page went blank after I fired an event from a dynamically loaded user control.Solution: This can happen if user controls were improperly loaded. When loading user controls,you need to have two things in mind:
102+
This can happen if user controls were improperly loaded. When loading user controls,you need to have two things in mind:
122103

123104
* Always recreate the last loaded user control on **Page_Init/Page_Load** .
124105

125106
* Assign unique IDs to the loaded controls.If the page goes blank, check if the control is always recreated. For more information about how to load user controls dynamically,please refer to [this]({%slug ajaxpanel/how-to/load-user-controls%}) topic.
126107

127-
6. Problem: After postback/AJAX request, my control does not keep its last state.Solution: This can happen if you are loading user controls and you do not assign unique IDs to them.In this case, the framework will generate an automatic ID which can be different than the original ID and therefore the ViewState is being lost.This is the cause for losing the last state of the control.
108+
## After postback/AJAX request, my control does not keep its last state.
109+
110+
This can happen if you are loading user controls and you do not assign unique IDs to them.In this case, the framework will generate an automatic ID which can be different than the original ID and therefore the ViewState is being lost.This is the cause for losing the last state of the control.
111+
112+
## After dynamically loading a user control, I cannot fire the events of any of its controls.
113+
114+
This is caused by improper loading of the user controls. If the control is persisted on the page, but its events are not fired, check to see if you have assigned an ID to this control. This is required by the framework to preserve theViewState and handle the control events.
115+
116+
## LoadingPanel is not displayed when dynamically created controls in a user control trigger the AJAXrequest.
117+
118+
I have a user control that is populated with dynamically created controls. After I have AJAX-enabled the user control with **RadAjaxPanel(RadAjaxManager)**, the loading panel I have specified does not display at all when any of the dynamically created controls triggers the AJAX request (though the AJAX request itself is completed successfully and the content is updated).Solution: The most likely reason for this behavior is missing ID for the dynamically created controls.Please make sure you are assigning an ID to the controls and you should experience no further problems.
128119

129-
7. Problem: After dynamically loading a user control, I cannot fire the events of any of its controls.Solution: This is caused by improper loading of the user controls. If the control is persisted on the page, but its events are not fired, check to see if you have assigned an ID to this control. This is required by the framework to preserve theViewState and handle the control events.
120+
## I used RadAjax to AJAX-enable controls but they are showing up twice.
130121

131-
8. Problem: I have a user control that is populated with dynamically created controls. After I have AJAX-enabled the user control with **RadAjaxPanel(RadAjaxManager)**, the loading panel I have specified does not display at all when any of the dynamically created controls triggers the AJAX request (though the AJAX request itself is completed successfully and the content is updated).Solution: The most likely reason for this behavior is missing ID for the dynamically created controls.Please make sure you are assigning an ID to the controls and you should experience no further problems.
122+
This can happen if you have added controls to the Page controls collection dynamically on**Page.Render** and the page is AJAX-enabled through **RadAjax**. The control, is rendering twice because **RadAjax** is calling the **Render** method twice in order to achieve partial rendering.The additional call of the method is for rendering the AJAX-enabled controls only. However, note that the page itself is rendered once.Therefore, you should add controls earlier in the **Page** life cycle.
132123

133-
9. Problem: I used **RadAjax** to AJAX-enable controls but they are showing up twice.Solution: This can happen if you have added controls to the Page controls collection dynamically on**Page.Render** and the page is AJAX-enabled through **RadAjax**. The control, is rendering twice because **RadAjax** is calling the **Render** method twice in order to achieve partial rendering.The additional call of the method is for rendering the AJAX-enabled controls only. However, note that the page itself is rendered once.Therefore, you should add controls earlier in the **Page** life cycle.
124+
## UseSubmitBehavior for ASP Button is ignored when the control is AJAX enabled through RadAjaxManager or RadAjaxPanel
134125

135-
10. Problem: **UseSubmitBehavior** for **ASP Button** is ignored when the control is AJAX enabled through **RadAjaxManager** or **RadAjaxPanel** .When you enable AJAX for **ASP Button** through **RadAjaxManager** or **RadAjaxPanel** ,the **UseSubmitBehavior** property of the button is internally set to **false** ,which causes the input element rendered for the button to always be set to "**button** ".
126+
When you enable AJAX for **ASP Button** through **RadAjaxManager** or **RadAjaxPanel** ,the **UseSubmitBehavior** property of the button is internally set to **false** ,which causes the input element rendered for the button to always be set to "**button** ".
136127

137128
## See Also
138129

controls/combobox/troubleshooting/back-button-and-selectedvalue.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,51 +28,51 @@ The combobox shows the correct text, but the SelectedValue property is incorrect
2828

2929
**WORKAROUND**
3030

31-
1. Add a hidden field to the page that will hold the selected value of the combobox:
31+
First, add a hidden field to the page that will hold the selected value of the combobox:
3232

33-
```ASPNET
34-
<input type="hidden" id="RadComboBox1Value" value="" />
35-
```
33+
````HTML
34+
<input type="hidden" id="RadComboBox1Value" value="" />
35+
````
3636

37-
2. Subscribe to the [OnClientSelectedIndexChanged]({%slug combobox/client-side-programming/events/onclientselectedindexchanged%}) event and update that hidden field:
37+
After that, subscribe to the [OnClientSelectedIndexChanged]({%slug combobox/client-side-programming/events/onclientselectedindexchanged%}) event and update that hidden field:
3838

3939
````JavaScript
40-
function onSelectedIndexChanged(sender, eventArgs) {
41-
$get("RadComboBox1Value").value = eventArgs.get_item().get_value();
42-
}
40+
function onSelectedIndexChanged(sender, eventArgs) {
41+
$get("RadComboBox1Value").value = eventArgs.get_item().get_value();
42+
}
4343
````
4444

45-
3. On pageLoad() check for the value of the hidden field. If it is not empty - find the appropriate combo item and select it:
45+
In the end, on `pageLoad()` check for the value of the hidden field. If it is not empty - find the appropriate combo item and select it:
4646

4747
````JavaScript
4848
function pageLoad() {
4949
var savedValue = $get("RadComboBox1Value").value;
5050
var combo = $find('<%= RadComboBox1.ClientID %>');
51+
5152
if (savedValue != "" && combo.findItemByValue(savedValue)) {
52-
combo.findItemByValue(savedValue).select();
53+
combo.findItemByValue(savedValue).select();
5354
}
5455
}
5556
````
5657

57-
58-
5958
Here is the final code:
6059

61-
```HTML
60+
````ASP.NET
6261
<telerik:RadComboBox RenderMode="Lightweight" ID="RadComboBox1"
63-
runat="server"
64-
OnClientSelectedIndexChanged="onSelectedIndexChanged">
65-
<Items>
66-
<telerik:RadComboBoxItem runat="server" Text="Red" Value="red" />
67-
<telerik:RadComboBoxItem runat="server" Text="Blue" Value="blue" />
68-
<telerik:RadComboBoxItem runat="server" Text="Green" Value="Green" />
69-
</Items>
62+
runat="server"
63+
OnClientSelectedIndexChanged="onSelectedIndexChanged">
64+
<Items>
65+
<telerik:RadComboBoxItem runat="server" Text="Red" Value="red" />
66+
<telerik:RadComboBoxItem runat="server" Text="Blue" Value="blue" />
67+
<telerik:RadComboBoxItem runat="server" Text="Green" Value="Green" />
68+
</Items>
7069
</telerik:RadComboBox>
71-
70+
7271
<input type="hidden" id="RadComboBox1Value" value="" />
73-
7472
<asp:Button ID="Button1" runat="server" Text="Button that Redirects" />
75-
<script type="text/javascript">
73+
````
74+
75+
````JavaScript
7676
function pageLoad() {
7777
var savedValue = $get("RadComboBox1Value").value;
7878
var combo = $find('<%= RadComboBox1.ClientID %>');
@@ -85,8 +85,5 @@ Here is the final code:
8585
function onSelectedIndexChanged(sender, eventArgs) {
8686
$get("RadComboBox1Value").value = eventArgs.get_item().get_value();
8787
}
88-
</script>
89-
```
90-
91-
88+
````
9289

0 commit comments

Comments
 (0)