Button skin set with FormDecorator gets unset on javascript alert

14 posts, 1 answers
  1. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post


  2. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    Button Skin set to Vista with FormDecorator gets unset on javascript alert using code-behind ScriptManager.RegisterStartupScript
    for ex;  ScriptManager.RegisterStartupScript(this, GetType(), "ViewError", "alert('File not found - please either scan, upload, or fill out the document first.');", true);
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Appeal" Title="Untitled Page"  %>
    <%@ 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>
      
    <title>Issue with RadFormDecorator</title>
      
    </head>
      
    <body>
     
    <telerik:RadFormDecorator ID="rfd1" EnableAjaxSkinRendering="true" DecoratedControls="Buttons, Scrollbars, Select, Textbox, Textarea, Label, ValidationSummary"
            Runat="server" Skin="Vista"/>   
     
            <form runat="server">
            <telerik:RadScriptManager ID="ScriptManager1" runat="server"/>  
                <asp:Label runat="server" Text="First Name" />
                <asp:TextBox runat="server" ID="textbox1" Text="" />
     
               <asp:Button runat="server" ID="button2" Text="Clear" OnClick="btnClear" />
               <asp:Button runat="server" ID="button1" Text="Submit" OnClick="btnSubmit" />
     
            </form>
     
    </body>
      
    </html>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Text;
    using System.Web.UI;
    using Telerik.Web.UI;
    using System.Data;
    using System.Collections;
    using System.Data.SqlClient;
     
    namespace WebApplication1
    {
        public partial class Appeal : System.Web.UI.Page    {
     
            protected void Page_Load(object sender, EventArgs e) {          
                
            }
     
            protected void btnSubmit(object sender, EventArgs e) {
                ScriptManager.RegisterStartupScript(this, GetType(), "Submit", "alert('Your data has been submitted');", true);
            }
     
            protected void btnClear(object sender, EventArgs e)
            {
                 
         
            }
        }
    }
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Text;
    using System.Web.UI;
    using Telerik.Web.UI;
    using System.Data;
    using System.Collections;
    using System.Data.SqlClient;
     
    namespace WebApplication1
    {
        public partial class Appeal : System.Web.UI.Page    {
     
            protected void Page_Load(object sender, EventArgs e) {          
                
            }
     
            protected void btnSubmit(object sender, EventArgs e) {
                ScriptManager.RegisterStartupScript(this, GetType(), "Submit", "alert('Your data has been submitted');", true);
            }
     
            protected void btnClear(object sender, EventArgs e)
            {
                 
         
            }
        }
    }
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Appeal" Title="Untitled Page"  %>
    <%@ 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>
      
    <title>Issue with RadFormDecorator</title>
      
    </head>
      
    <body>
     
    <telerik:RadFormDecorator ID="rfd1" EnableAjaxSkinRendering="true" DecoratedControls="Buttons, Scrollbars, Select, Textbox, Textarea, Label, ValidationSummary"
            Runat="server" Skin="Vista"/>   
     
            <form runat="server">
            <telerik:RadScriptManager ID="ScriptManager1" runat="server"/>  
                <asp:Label runat="server" Text="First Name" />
                <asp:TextBox runat="server" ID="textbox1" Text="" />
     
               <asp:Button runat="server" ID="button2" Text="Clear" OnClick="btnClear" />
               <asp:Button runat="server" ID="button1" Text="Submit" OnClick="btnSubmit" />
     
            </form>
     
    </body>
      
    </html>
  5. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Appeal" Title="Untitled Page"  %>
    <%@ 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>
      
    <title>Issue with RadFormDecorator</title>
      
    </head>
      
    <body>
     
    <telerik:RadFormDecorator ID="rfd1" EnableAjaxSkinRendering="true" DecoratedControls="Buttons, Scrollbars, Select, Textbox, Textarea, Label, ValidationSummary"
            Runat="server" Skin="Vista"/>   
     
            <form runat="server">
            <telerik:RadScriptManager ID="ScriptManager1" runat="server"/>  
                <asp:Label runat="server" Text="First Name" />
                <asp:TextBox runat="server" ID="textbox1" Text="" />
     
               <asp:Button runat="server" ID="button2" Text="Clear" OnClick="btnClear" />
               <asp:Button runat="server" ID="button1" Text="Submit" OnClick="btnSubmit" />
     
            </form>
     
    </body>
      
    </html>
    Button Skin set to Vista with FormDecorator gets unset on javascript alert using code-behind ScriptManager.RegisterStartupScript
    for ex;  ScriptManager.RegisterStartupScript(this, GetType(), "ViewError", "alert('File not found - please either scan, upload, or fill out the document first.');", true);
  6. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    I have set EnableAjaxSkinRendering="true" in the telerik:RadFormDecorator control DecoratedControls="Buttons...." Skin="Vista" Runat="server"
  7. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Appeal" Title="Untitled Page"  %>
    <%@ 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>
      
    <title>Issue with RadFormDecorator</title>
      
    </head>
      
    <body>
     
    <telerik:RadFormDecorator ID="rfd1" EnableAjaxSkinRendering="false" DecoratedControls="Buttons, Scrollbars, Select, Textbox, Textarea, Label, ValidationSummary"
            Runat="server" Skin="Vista"/>   
     
            <form runat="server">
            <telerik:RadScriptManager ID="ScriptManager1" runat="server"/>  
                <asp:Label runat="server" Text="First Name" />
                <asp:TextBox runat="server" ID="textbox1" Text="" />
     
               <asp:Button runat="server" ID="button2" Text="Clear" OnClick="btnClear" />
               <asp:Button runat="server" ID="button1" Text="Submit" OnClick="btnSubmit" />
     
            </form>
     
    </body>
      
    </html>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Text;
    using System.Web.UI;
    using Telerik.Web.UI;
    using System.Data;
    using System.Collections;
    using System.Data.SqlClient;
     
    namespace WebApplication1
    {
        public partial class Appeal : System.Web.UI.Page    {
     
            protected void Page_Load(object sender, EventArgs e) {          
                
            }
     
            protected void btnSubmit(object sender, EventArgs e) {
                ScriptManager.RegisterStartupScript(this, GetType(), "Submit", "alert('Your data has been submitted');", true);
            }
     
            protected void btnClear(object sender, EventArgs e)
            {
                 
         
            }
        }
    }
    I have set EnableAjaxSkinRendering="true" in the telerik:RadFormDecorator control DecoratedControls="Buttons...." Skin="Vista" Runat="server"
  8. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Text;
    using System.Web.UI;
    using Telerik.Web.UI;
    using System.Data;
    using System.Collections;
    using System.Data.SqlClient;
     
    namespace WebApplication1
    {
        public partial class Appeal : System.Web.UI.Page    {
     
            protected void Page_Load(object sender, EventArgs e) {          
                
            }
     
            protected void btnSubmit(object sender, EventArgs e) {
                ScriptManager.RegisterStartupScript(this, GetType(), "Submit", "alert('Your data has been submitted');", true);
            }
     
            protected void btnClear(object sender, EventArgs e)
            {
                 
         
            }
        }
    }
  9. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Appeal" Title="Untitled Page"  %>
    <%@ 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>
      
    <title>Issue with RadFormDecorator</title>
      
    </head>
      
    <body>
     
    <telerik:RadFormDecorator ID="rfd1" EnableAjaxSkinRendering="false" DecoratedControls="Buttons, Scrollbars, Select, Textbox, Textarea, Label, ValidationSummary"
            Runat="server" Skin="Vista"/>   
     
            <form runat="server">
            <telerik:RadScriptManager ID="ScriptManager1" runat="server"/>  
                <asp:Label runat="server" Text="First Name" />
                <asp:TextBox runat="server" ID="textbox1" Text="" />
     
               <asp:Button runat="server" ID="button2" Text="Clear" OnClick="btnClear" />
               <asp:Button runat="server" ID="button1" Text="Submit" OnClick="btnSubmit" />
     
            </form>
     
    </body>
      
    </html>
  10. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Appeal" Title="Untitled Page"  %>
    <%@ 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>
      
    <title>Issue with RadFormDecorator</title>
      
    </head>
      
    <body>
     
    <telerik:RadFormDecorator ID="rfd1" EnableAjaxSkinRendering="false" DecoratedControls="Buttons, Scrollbars, Select, Textbox, Textarea, Label, ValidationSummary"
            Runat="server" Skin="Vista"/>   
     
            <form runat="server">
            <telerik:RadScriptManager ID="ScriptManager1" runat="server"/>  
                <asp:Label runat="server" Text="First Name" />
                <asp:TextBox runat="server" ID="textbox1" Text="" />
     
               <asp:Button runat="server" ID="button2" Text="Clear" OnClick="btnClear" />
               <asp:Button runat="server" ID="button1" Text="Submit" OnClick="btnSubmit" />
     
            </form>
     
    </body>
      
    </html>
  11. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 01 Oct 2012 Link to this post

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Appeal" Title="Untitled Page"  %>
    <%@ 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>
      
    <title>Issue with RadFormDecorator</title>
      
    </head>
      
    <body>
     
    <telerik:RadFormDecorator ID="rfd1" EnableAjaxSkinRendering="false" DecoratedControls="Buttons, Scrollbars, Select, Textbox, Textarea, Label, ValidationSummary"
            Runat="server" Skin="Vista"/>   
     
            <form runat="server">
            <telerik:RadScriptManager ID="ScriptManager1" runat="server"/>  
                <asp:Label runat="server" Text="First Name" />
                <asp:TextBox runat="server" ID="textbox1" Text="" />
     
               <asp:Button runat="server" ID="button2" Text="Clear" OnClick="btnClear" />
               <asp:Button runat="server" ID="button1" Text="Submit" OnClick="btnSubmit" />
     
            </form>
     
    </body>
      
    </html>
  12. Bozhidar
    Admin
    Bozhidar avatar
    677 posts

    Posted 04 Oct 2012 Link to this post

    Hi,

    Excuse us for the late reply. I have tested your code and I see than onclick the buttons disappear for a moment. Could you confirm, that this is the problem, and could you send us screenshot to clarify it, so we would be able to test it further.

    All the best,
    Bozhidar
    the Telerik team
    Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
  13. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 04 Oct 2012 Link to this post

    On click when javascript alert shows up the buttons don't disappear but the Vista skin for the button (applied via RadFormDecorator) changes back to the regular asp button without the skin. How do I fix this.

  14. Answer
    Bozhidar
    Admin
    Bozhidar avatar
    677 posts

    Posted 08 Oct 2012 Link to this post

    Hi,

    As it makes post back when it is clicked,  it is necessary to ensure that the form Decorator is loaded on page before the script and decorates the elements that should be decorated, that`s why we are using small timeout:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    public partial class RFDButonDivMargin_Default : System.Web.UI.Page
    {
        public partial class Appeal : System.Web.UI.Page
        {
     
     
        }
        protected void btnClear(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "Submit", "function pageLoad() { setTimeout(function() {alert('Your data has been submitted'); }, 0); }", true);
        }
        protected void btnSubmit(object sender, EventArgs e)
        {
     
        }
    }

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadFormDecorator ID="RadFormDecorator1" _EnableAjaxSkinRendering="false"
            DecoratedControls="All" runat="server" Skin="Office2010Blue" />
        <asp:Label ID="Label1" runat="server" Text="First Name" />
        <asp:TextBox runat="server" ID="textbox1" Text="" />
        <asp:Button runat="server" ID="button2" Text="Clear" OnClick="btnClear" />
        <asp:Button runat="server" ID="button1" Text="Submit" OnClick="btnSubmit" />
         
        </form>

    Can you try this fix to check if it works?

    Regards,
    Bozhidar
    the Telerik team
    Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
  15. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 11 Oct 2012 Link to this post

    Thanks
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017