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

Something IS wrong with ScriptManager

9 Answers 143 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Basel Nimer
Top achievements
Rank 2
Basel Nimer asked on 02 Nov 2009, 02:02 PM
Whenever it is just added to a form, Custom validation (ASP.NET validations) stop working.

Please see the following two samples, the first one does not work while the other works, the only difference is adding the scriptmanager.

this does not work
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestBasel2.aspx.vb" Inherits="TestBasel2" %> 
<%@ 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"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<body> 
    <form id="form1" runat="server"
    <div> 
                            <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager>  
         
         
         
<script language="javascript" type="text/javascript"
function ClientValidateUpload2(source, arguments) 
alert(1); 
}                                
</script>    
 
 
    <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" ClientValidationFunction=ClientValidateUpload2 ></asp:CustomValidator> 
     
    <asp:Button ID="Button1" runat="server" Text="Upload"   CausesValidation=true /> 
    </div> 
    </form> 
</body> 
</html> 
 

this works
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestBasel2.aspx.vb" Inherits="TestBasel2" %> 
<%@ 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"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<body> 
    <form id="form1" runat="server"
    <div> 
     
         
         
<script language="javascript" type="text/javascript"
function ClientValidateUpload2(source, arguments) 
alert(1); 
}                                
</script>    
 
 
    <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" ClientValidationFunction=ClientValidateUpload2 ></asp:CustomValidator> 
     
    <asp:Button ID="Button1" runat="server" Text="Upload"   CausesValidation=true /> 
    </div> 
    </form> 
</body> 
</html> 
 


I also added a comment to one of your posts earlier which states that CustomValidation is not working with RadUpload, i eliminated why here.

Please help.
we are using Q2 2009

9 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 02 Nov 2009, 02:14 PM
Hi Basel Nimer,

The provided code snippet was tested locally and it works just fine. I think it will be best if you can open a support ticket and send us a simple running project (incl. your custom skin, CSS, images, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Sincerely yours,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Basel Nimer
Top achievements
Rank 2
answered on 02 Nov 2009, 03:13 PM
Thank you for your prompt reply,

I tested this in a new web application (VS.NET 2005), I just did the following:
1- Created a new project
2- in the web page i added a custom validation and a button and a script for custom validation (see below)
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> 
 
<!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 runat="server"
    <title>Test 1</title> 
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
            <script language="javascript" type="text/javascript"
            function ClientValidateUpload2(source, arguments) 
            { 
            alert(1); 
            }                                
            </script>    
 
            <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" ClientValidationFunction=ClientValidateUpload2 ></asp:CustomValidator> 
             
            <asp:Button ID="Button1" runat="server" Text="Upload"   CausesValidation=true /> 
    </div> 
    </form> 
</body> 
</html> 
3- I tested it, got the alert when clicking the button (see first attachment)
4- I added a script manager to the page (see second attachment)
5- when i ran it, it gave an error for not registering an HTTPHelper, i registered the HTTPHelper using the ScriptManager designtime tasks
6- the code now is
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" 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"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title>Test 1</title> 
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
            <script language="javascript" type="text/javascript"
            function ClientValidateUpload2(source, arguments) 
            { 
            alert(1); 
            }                                
            </script>    
 
            <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" ClientValidationFunction=ClientValidateUpload2 ></asp:CustomValidator> 
             
            <asp:Button ID="Button1" runat="server" Text="Upload"   CausesValidation=true /> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
    </div> 
    </form> 
</body> 
</html> 
 

7-i ran the application
8- Now clicking the button does postback with no alerts.

I can open a ticket but this would take more time for that the email attached to the account is my Boss, and i dont get notified.

let me if this is not fine with you and i will post a ticket (even that this is all the code i have)

0
Basel Nimer
Top achievements
Rank 2
answered on 03 Nov 2009, 10:05 AM
Mmmm....
This is the first time Telerik Support take this time to reply to me, Please let me know if a ticket is really needed so that i can contact my boss in order to create it.
0
Paul
Telerik team
answered on 04 Nov 2009, 01:04 PM
Hi Basel Nimer,

As already stated, we tested your pasted code in a local project and it runs just fine. Please find attached the mentioned project.

Greetings,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Basel Nimer
Top achievements
Rank 2
answered on 04 Nov 2009, 03:10 PM
apparently you are using the 35 version,i am using the 20 version. as i said, i am using VS 2005.

to be more specific, my version of the file is 2009.2.826.20

 

0
Veselin Vasilev
Telerik team
answered on 10 Nov 2009, 04:14 PM
Hello Basel Nimer,

If you replace the RadScriptManager with the <asp:ScriptManager> you will experience the same behavior.

What you need to do in this case is to set the IsValid property of the validation function to False:

<script language="javascript" type="text/javascript">
function ClientValidateUpload2(source, arguments)
{
    alert(1);
    arguments.IsValid = false;
}                               
</script>

This way the validator will fail and there will be no postback.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Basel Nimer
Top achievements
Rank 2
answered on 10 Nov 2009, 09:36 PM
Well, The problem is that the alert itself does not work.

anyhow, i tried it and it didnt work even with arguments.IsValid = false;

AND...

replacing
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
with
        <asp:ScriptManager> 
        </asp:ScriptManager> 
did work normally and as expected.

Please make sure that you are using the correct version, Thank you.

0
Paul
Telerik team
answered on 13 Nov 2009, 03:19 PM
Hello Basel,

Frankly, we don't think that the .NET version is important in this case. Still, we tested your case in a .NET 2 application and everything runs just fine.

I'm afraid we could not be of much help unless we reproduce the issue on our side. It will be best if you can open a support ticket and send us a simple running project (incl. your custom skin, CSS, images, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Regards,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Alaa Majzoub
Top achievements
Rank 2
answered on 13 Nov 2009, 04:29 PM
Hello, Please check Ticket 258657

Tags
ScriptManager and StyleSheetManager
Asked by
Basel Nimer
Top achievements
Rank 2
Answers by
Paul
Telerik team
Basel Nimer
Top achievements
Rank 2
Veselin Vasilev
Telerik team
Alaa Majzoub
Top achievements
Rank 2
Share this question
or