Declined
Last Updated: 28 Dec 2022 13:08 by ADMIN
ADMIN
Marin Bratanov
Created on: 02 Feb 2017 11:58
Category: Button
Type: Bug Report
1
You cannot enable a RadButton with disabled ViewState

select an item from the dropdown, different than "1" expected: buttons become enabled actual: radbutton is still disabled

<asp:Button ID="ButtonTest" runat="server" enabled="true" Text="Test" EnableViewState="False" />
<telerik:RadPushButton ID="RadButtonTest" runat="server" Text="RadButtonTest" Enabled="True" EnableViewState="False" RenderMode="Lightweight"></telerik:RadPushButton>
<asp:DropDownList runat="server" ID="DropDownTest" AutoPostBack="True" OnSelectedIndexChanged="SelectedIndexChanged_Test">
    <Items>
        <asp:ListItem Text="1" Value="1"></asp:ListItem>
        <asp:ListItem Text="2" Value="2"></asp:ListItem>
        <asp:ListItem Text="3" Value="3"></asp:ListItem>
        <asp:ListItem Text="4" Value="4"></asp:ListItem>
    </Items>
</asp:DropDownList>

 

protected void Page_LoadComplete(object sender, EventArgs e)
{
    if (DropDownTest.SelectedValue == "1")
    {
        ButtonTest.Enabled = false;
        RadButtonTest.Enabled = false;
    }
    else//workaround
    {
        string script = string.Format("function f(){{$find('{0}').set_enabled({1});Sys.Application.remove_load(f);}}Sys.Application.add_load(f);",
                                            RadButtonTest.ClientID,
                                            "true");
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "someKey", script, true);
    }
}

protected void SelectedIndexChanged_Test(object sender, EventArgs e)
{
}

1 comment
ADMIN
Attila Antal
Posted on: 28 Dec 2022 13:08

The Control.EnableViewState Property is automatically inherited from the Control Class, however, the functionality was not implemented in the RadButton. The current behavior is the expected one for the button.

For a list of available Properties and Events, you can check out the RadButton Properties and Events documentation and the Telerik.Web.UI.RadButton Server APIs.

Having that in mind, the button must be enabled/disabled manually through the property. Set the Enabled property to True to enable the button, or to False to disable it.

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.