Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > Issues with Validation and rad ajax
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Issues with Validation and rad ajax

Feed from this thread
  • Posted on May 18, 2011 (permalink)

    Hi , 
    I have implemented rad ajax in the master page and in the content page i have validations .
    I need to display the validations in a custom window , so i had to do EnableClientScript="false" for the validators.
    Here is my code:

    In master Page


     <script type="text/javascript">
            function RequestStart(sender, args) {
                if (args.EventTarget.indexOf('btnExport') != -1) {
                    args.EnableAjax = false;
                }
                if (args.EventTarget.indexOf('btnsendMail') != -1) {
                    args.EnableAjax = false;
                } 
            }
        </script>


          <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true" 


    OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                </telerik:RadAjaxManager>
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" MinDisplayTime="1000"
                    Skin="Vista" ZIndex="9999" InitialDelayTime="0" BackgroundPosition="Center" 


    EnableEmbeddedSkins="true">
                </telerik:RadAjaxLoadingPanel>
                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel2"
                    EnableAJAX="true">
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                    </asp:ContentPlaceHolder>
                </telerik:RadAjaxPanel>




    *****In Example.cs*********
    I Page load (if not post back)
      RadAjaxManager mgr = RadAjaxManager.GetCurrent(Page);
            mgr.AjaxSettings.Clear();
            mgr.AjaxSettings.AddAjaxSetting(mgr, pnlContent);
            mgr.AjaxSettings.AddAjaxSetting(btnsendMail, pnlContent);
            mgr.AjaxSettings.AddAjaxSetting(btnsendMail, pnlContent, (RadAjaxLoadingPanel)(this.Page.Master as 


    MasterPage).FindControl("RadAjaxLoadingPanel2"));
            mgr.AjaxSettings.AddAjaxSetting(mgr, pnlContent, (RadAjaxLoadingPanel)(this.Page.Master as 


    MasterPage).FindControl("RadAjaxLoadingPanel2"));


            mgr.ClientEvents.OnRequestStart = "RequestStart"; 


    ---------------------------------------------------------------------------
    in Example.aspx
    <telerik:RadTextBox ID="Rtxtmsg" runat="server" TextMode="MultiLine" >
                        </telerik:RadTextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator16" ErrorMessage="Please  Enter  


    Message"
                            ControlToValidate="Rtxtmsg" runat="server" SetFocusOnError="true" 


    EnableClientScript="false"
                            ValidationGroup="SAVE">&nbsp;</asp:RequiredFieldValidator> 




     <telerik:RadButton ID="btnsendMail" runat="server" ValidationGroup="SAVE" OnClick="btnsendMail_Click"
                        Icon-PrimaryIconCssClass="rbPrimaryIcon_Edit" Text="Send" CssClass="radButton_plain">
                        <Image IsBackgroundImage="true" EnableImageButton="true" />
                    </telerik:RadButton>


      <asp:ValidationSummary runat="server" ID="Vs1" ValidationGroup="SAVE" EnableClientScript="false"
            ShowMessageBox="true" ShowSummary="false" />


    Now the validations does not fire when i click the send button , there is a attachment that has be uploaded on click event of the same send button. If I remove this line  mgr.ClientEvents.OnRequestStart = "RequestStart";   validations are fired but the attachment is not uploaded.
    What is the best solution for this
    Thanks and regards

  • Martin Martin admin's avatar

    Posted on May 23, 2011 (permalink)

    Hello SHERFUDEEN A,

    I have noticed that my colleague Veli has already answered the support ticket you have opened on the same topic. To avoid duplicate posts I would suggest that you continue the communication in the support thread.

    To make the answer available for our community, I am pasting Veli's post here as well:


    You are using both RadAjaxManager as well as RadAjaxPanel to AJAX-ify one and the same content in your page. This scenario is not supported. You should use either of the controls only. Only a single AJAX control should update a given part of your page. Try removing the RadAjaxPanel control and leave RadAjaxManager. Thus, you will be able to disable the AJAX postback through the client-side OnRequestStart event. Additionally, we would advise you to first set up your upload and validation scenario without any AJAX controls on the page. Once you know the setup is working OK, you can try adding the RadAjaxManager to see how the page behaves with AJAX postbacks. Let me know how it goes. If this problem persists, consider sending us some test page we can debug locally. This will help us better identify the cause of this issue and advise you further.


    I hope this helps.

    Best wishes,
    Martin
    the Telerik team

    Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > Issues with Validation and rad ajax