Disabling Buttons on the Client

2 posts, 0 answers
  1. Christopher Blickley
    Christopher Blickley avatar
    202 posts
    Member since:
    Jan 2004

    Posted 19 Jul 2010 Link to this post

    Hello:

    Are there any known issues with disabling a button on the client in WebKit browsers?  I would like to disable the buttons on the client, for example when the page is sumbmitted. This works fine without RadFormDecorator, but with RadFormDecorator, it doesn't work in Safari or Chrome.  The button gets disabled, but style doesn't change.  I was hoping for something that would be seamless between when the decorator is in use or not use so I don't have any custom javascript just for RadFormDecorator and can remove or disable it at will.  Here is a quick example aspx page that correcly changes the style in Firefox and IE, but not in Chrome/Safari.

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <head runat="server">
        <title></title>
        <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
        <script type="text/javascript">
            function test() {
                document.getElementById('<%= btnTest.ClientID %>').disabled = true;
            }
        </script>
        </telerik:RadScriptBlock>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <telerik:RadFormDecorator enabled="true" runat="server" ID="RadFormDecorator1" DecoratedControls="Buttons" />
            <asp:Button runat="server" ID="btnTest" Text="Disable Me" />
            <br />
            <br />
            <input type="button" value="Go" onclick="test();" />
        </div>
        </form>
    </body>
    </html>
  2. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 20 Jul 2010 Link to this post

    Hello Christopher,

    You should use  Telerik.Web.UI.RadFormDecorator.set_enabled method, e.g.
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    <html xmlns="http://www.w3.org/1999/xhtml">   
    <head>  
        <title></title>   
        <script type="text/javascript">
            function toggleEnable()
            {
                var btn = $get('nextButton');
                Telerik.Web.UI.RadFormDecorator.set_enabled(btn, btn.disabled)
            }   
        </script>  
    </head>  
    <body>  
        <form id="form1" runat="server">   
        <asp:ScriptManager ID="ScriptManager1" runat="server">   
        </asp:ScriptManager>  
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" />  
        <input type="button" value="setEnableDisableToTheNextButton" onclick="toggleEnable()"/>   
        <input type="button" id="nextButton" value="NEXT BUTTON" />  
        </form>  
    </body>  
    Let us know if you have any other questions.


    Best wishes,
    Petio Petkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top