This is a migrated thread and some comments may be shown as answers.

Button skin set with FormDecorator gets unset on javascript alert

13 Answers 98 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Jinisha
Top achievements
Rank 1
Jinisha asked on 01 Oct 2012, 03:34 PM

13 Answers, 1 is accepted

Sort by
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 04:39 PM
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)
        {
             
     
        }
    }
}
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 04:40 PM
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>
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 04:41 PM
<%@ 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);
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 04:42 PM
I have set EnableAjaxSkinRendering="true" in the telerik:RadFormDecorator control DecoratedControls="Buttons...." Skin="Vista" Runat="server"
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 05:44 PM
<%@ 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"
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 05:44 PM
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)
        {
             
     
        }
    }
}
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 05:45 PM
<%@ 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>
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 05:46 PM
<%@ 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>
0
Jinisha
Top achievements
Rank 1
answered on 01 Oct 2012, 05:47 PM
<%@ 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>
0
Bozhidar
Telerik team
answered on 04 Oct 2012, 03:38 PM
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.
0
Jinisha
Top achievements
Rank 1
answered on 04 Oct 2012, 04:04 PM
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.

0
Accepted
Bozhidar
Telerik team
answered on 08 Oct 2012, 02:42 PM
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.
0
Jinisha
Top achievements
Rank 1
answered on 11 Oct 2012, 09:17 PM
Thanks
Tags
FormDecorator
Asked by
Jinisha
Top achievements
Rank 1
Answers by
Jinisha
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or