Pending Review
Last Updated: 02 Feb 2017 11:59 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)
		{
		}
0 comments