I have a RadPanelBar with an RadPanelItem collection declared in the markup (it's not built dynamically). On the page load in the codebehind, I disable all but the first panel item. I disable panel items like this:
RadPanelBar1.FindItemByValue("Quantity").Enabled = false;
Then, when a RadGrid row is double-clicked in first, enabled RadPanelItem, I use the RadGrid's client-side API to enable the next panel item via Javascript. The Javascript performs as expected and enables the panel item, but all of the controls within the newly enabled panel are disabled.
I just discovered this after making a modification to a page. Previously, we set these panels to disabled via Javascript using the following code:
panel.findItemByValue("PriceStructure").disable();
This disabled only the panel item itself and not the controls within the panel item. However, now we need to disable these in the codebehind, but all the controls within the item become disabled.
How do I keep this from happening when disabling panel items in the codebehind?
RadPanelBar1.FindItemByValue("Quantity").Enabled = false;
Then, when a RadGrid row is double-clicked in first, enabled RadPanelItem, I use the RadGrid's client-side API to enable the next panel item via Javascript. The Javascript performs as expected and enables the panel item, but all of the controls within the newly enabled panel are disabled.
I just discovered this after making a modification to a page. Previously, we set these panels to disabled via Javascript using the following code:
panel.findItemByValue("PriceStructure").disable();
This disabled only the panel item itself and not the controls within the panel item. However, now we need to disable these in the codebehind, but all the controls within the item become disabled.
How do I keep this from happening when disabling panel items in the codebehind?
Can you provide the javascript function that you use to enable the RadPanelBarItems as well the markup of the page so we can test it locally?
Thanks
Regards,
Kate
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Markup
<
telerik:RadPanelBar
runat
=
"server"
ID
=
"RadPanelBar1"
Width
=
"575px"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
"Test"
Value
=
"TestPanel1"
Expanded
=
"true"
Selected
=
"true"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txTest"
runat
=
"server"
/>
<
asp:DropDownList
ID
=
"ddTest"
runat
=
"server"
>
<
asp:ListItem
Text
=
"Test1"
/>
<
asp:ListItem
Text
=
"Test2"
/>
</
asp:DropDownList
>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelItem
>
<
telerik:RadPanelItem
runat
=
"server"
Text
=
"Test"
Value
=
"TestPanel2"
Expanded
=
"true"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txTest2"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelBar
>
<
asp:HiddenField
ID
=
"hfUseScript"
Value
=
"1"
runat
=
"server"
/>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
language
=
"javascript"
type
=
"text/javascript"
>
Sys.Application.add_load(Load);
function Load() {
if (document.getElementById("<%=hfUseScript.ClientID %>").value == "1") {
var panel = $find("<%=RadPanelBar1.ClientID %>");
panel.findItemByValue("TestPanel1").disable();
}
}
</
script
>
</
telerik:RadCodeBlock
>
C#
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(hfUseScript.Value !=
"1"
)
RadPanelBar1.FindItemByValue(
"TestPanel1"
).Enabled =
false
;
}
Change the value of the hidden field to a "1" to use the client script and use any other value to execute the codebehind code. When the Javascript runs, it disables only the panel and does not affect the enabled state of the controls within it. When the codebehind code is run, though, it not only disables the tab, but also all controls within it.
What I want is for the controls in the tab to not be disabled when the tab is disabled in the codebehind (ie, I want it to behave identically to the clientside version).
I have provided my source code as requested. The above code can be pasted into a web form or a content form using a master page. I have even made it easy to toggle between client-side and server-side methods. Is anyone able to reproduce my issue?
We looked at the code that you have provided but besides the solutions that you have mentioned in the previous posts we can not come up with any other ideas that would fit your scenario better.
Kind regards,
Kate
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.