Something IS wrong with ScriptManager

10 posts, 0 answers
  1. Basel Nimer
    Basel Nimer avatar
    94 posts
    Member since:
    Oct 2009

    Posted 02 Nov 2009 Link to this post

    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

  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 02 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Basel Nimer
    Basel Nimer avatar
    94 posts
    Member since:
    Oct 2009

    Posted 02 Nov 2009 Link to this post

    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)

  5. Basel Nimer
    Basel Nimer avatar
    94 posts
    Member since:
    Oct 2009

    Posted 03 Nov 2009 Link to this post

    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.
  6. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 04 Nov 2009 Link to this post

    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.
  7. Basel Nimer
    Basel Nimer avatar
    94 posts
    Member since:
    Oct 2009

    Posted 04 Nov 2009 Link to this post

    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

     

  8. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 10 Nov 2009 Link to this post

    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.
  9. Basel Nimer
    Basel Nimer avatar
    94 posts
    Member since:
    Oct 2009

    Posted 10 Nov 2009 Link to this post

    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.

  10. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 13 Nov 2009 Link to this post

    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.
  11. Alaa Majzoub
    Alaa Majzoub avatar
    49 posts
    Member since:
    Nov 2007

    Posted 13 Nov 2009 Link to this post

    Hello, Please check Ticket 258657

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