telerik - RadAjaxManager problem when showing/hiding control on page loading -
I have a webform with dropdown list, labels and textbox as follows:
& Lt; Asp: dropdown list id = "ddlTest" runat = "server" autopost = "true" & gt; & Lt; / ASP: DropDownList & gt; & Lt; Asp: Label ID = "lblTest" runat = "server" text = "some text" & gt; & Lt; / ASP: Labels & gt; & Lt; Asp: text box id = "edtTest" runat = "server" & gt; & Lt; / ASP: text box & gt;
I want to show / hide the label / text box based on the selected value in the dropdown list. That's why I've added RadAjaxManader:
& Lt; Rad: AjaxUpdatedControl ControlID = "edtTest" /> & Lt; / UpdatedControls & gt; & Lt; / Red: AjaxSetting & gt; & Lt; / AjaxSettings & gt; & Lt; / Red: RadAjaxManager & gt;
And "Setup Upsability", which takes value from the dropdown list, does some futures and explains whether to show or hide the label and text box. When I use this kind of process:
Protected sub ddlTest_SelectedIndexChanged (ByVal handles this form, as byVal e System.EventArgs) ddlTest.SelectedIndexChanged SetupVisibility () End Sub < / Code>
This works well, but now I want to call SetupVisibility, when page load calls:
protected sub page_Load (ByVal As this object, ByVal E. System.EventArgs handles as me. Load SetupVisibility () End Sub
There is a problem in this scenario.
- SetupVisibility () hides the text box and label while the page loads
- Change the value to the ddlTest dropdown list
- SetupVisibility () text box And labels, but wants to show again > I:.
Microsoft JScript - Order Error: Can not update control with id: ctl00_CPH1_lblTest control does not exist.
Where is the problem?
I 've solved the problem I have written the text box and the label in the div and panel Is wrapped up:
& lt; Div id = "panelTest_DIV" runat = "server" & gt; & Lt; ASP: Panel ID = "PanelTest" Runat = "Server" & gt; & Lt; Asp: label id = "lblteest" runat = "server" text = "some text ..." & gt; & Lt; / Asp: label & gt; & Lt; Br / & gt; & Lt; Asp: text box id = "edtTest" runat = "server" & gt; & Lt; / Asp: text box & gt; & Lt; / ASP: Cell & gt; & Lt; / Div & gt;
and AjaxManager:
& lt; Red: AjaxSetting AjaxControlID = "ddlTest" & gt; & Lt; UpdatedControls & gt; & Lt; Rad: AjaxUpdatedControl ControlID = "panelTest_DIV" /> & Lt; / UpdatedControls & gt; & Lt; / Red: AjaxSetting & gt;
inside SetupVisibility ()
I set panelTest.Visibility
. Resolved this problem.
Comments
Post a Comment