Postback Issue With Ajaxmanager and Update Panel

4 posts, 1 answers
  1. Ed Molieri
    Ed Molieri avatar
    3 posts
    Member since:
    Sep 2009

    Posted 15 Sep 2009 Link to this post

    I'm trying to call some javascript which returns true/false depending if it passes a test.  I want my page to post back when a button is clicked but it isn't posting back if I set the update control or if I return true/false in my javascript.  here is sample of my code.

    This is a user control which is part of page which has other user controls.

     

    <

     

    script type="text/javascript">

     

     

     

     

     

    function ValidateWithRegEx()

     

     

     {

     

    var myRegxp =/^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.pdf|.PDF|.doc|.DOC|.xls|.XLS|.jpeg|.JPEG|.gif|.GIF|.tiff|.TIFF|.jpg|.JPG|.fla|.FLA|.avi|.AVI|.mov|.MOV|.wma|.WMA|.wmv|.WMV|.docx|.DOCX|.xlsx|.XLSX|.vsd|.VSD|.txt|.TXT)/;

     

     

     

     

     

    var fileUploaderValue = document.getElementById("ctl00_cphCenterPane_UxAttachments1_FIPSFileUploader").value;

     

     

     

    if( myRegxp.test(fileUploaderValue) )

    {

     

    return true;

    }

     

    else

     

     

    {

     

    alert(

    'File trying to upload is invalid');
     
    return false;

     

     

     }

    }

     

     

     

     

    </

     

    script>

     

     

     

     

     

     

    <

     

    table runat="server" id="masterTable">

     

     

     

    <tr>

     

    <td style="width: 453px">

     

    <asp:FileUpload ID="FIPSFileUploader" runat="server" Width="446px" /></td>

     

    </tr>

     

    <tr>

     

    <td style="width: 453px">

     

    <asp:Button ID="UploadFileButton" runat="server" Text="Upload File" OnClientClick="return ValidateWithRegEx();" OnClick="UploadFileButton_Click" />&nbsp;

     

     

     

     

    <asp:Label ID="lblError" runat="server" ForeColor="Red" Width="422px"></asp:Label></td>

     

    </tr>

     

     

    </

     

    table>

     

     

    <

     

    telerik:RadAjaxManagerProxy ID="AjaxManagerProxy" runat="server">

     

     

     

     

     

    <AjaxSettings>

     

     

     

     

    <telerik:AjaxSetting AjaxControlID="UploadFileButton">

     

     

     

     

    <UpdatedControls>

     

     

     

     

    <telerik:AjaxUpdatedControl ControlID="AttachmentsRadGrid" LoadingPanelID="UploadingPanel" />

     

     

     

     

    </UpdatedControls>

     

     

     

     

    </telerik:AjaxSetting>

     

     

     

     

    </AjaxSettings>

     

     

    </

     

    telerik:RadAjaxManagerProxy>

     

     

     

     

    &nbsp;

     

     

     

     

     

     

    <br />

     

     

    <

     

    telerik:RadAjaxLoadingPanel ID="UploadingPanel" runat="server" Height="75px" Width="75px" InitialDelayTime="1">

     

     

     

     

     

    <img alt="Loading..." src="../Images/animated_loading.gif" style="border-right: 0px;border-top: 0px; border-left: 0px; border-bottom:0px"/>

     

     

    </

     

    telerik:RadAjaxLoadingPanel>

     

     

     

    <

     

    telerik:RadGrid ID="AttachmentsRadGrid" runat="server" AutoGenerateColumns="False" GridLines="None" Skin="Forest">

     

     

     

     

     

    <MasterTableView Caption="&lt;b&gt;Attachments&lt;/b&gt;" CellSpacing="-1">

     

     

     

    <Columns>

     

     

     

    <telerik:GridBoundColumn DataField="InspectionAttachmentId" ReadOnly="True" UniqueName="InspectionAttachmentId" Visible="False">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridBoundColumn DataField="FileLocation" UniqueName="FileLocation" Visible="False">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridBoundColumn DataField="FileName" HeaderText="File Name" UniqueName="FileName">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridBoundColumn DataField="Description" HeaderText="Description" UniqueName="Description">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridBoundColumn DataField="CreatedDate" HeaderText="Created Date" UniqueName="CreatedDate">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridBoundColumn DataField="ModifiedDate" HeaderText="Modified Date" UniqueName="ModifiedDate">

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridEditCommandColumn>

     

     

     

    </telerik:GridEditCommandColumn>

     

     

     

    <telerik:GridButtonColumn CommandArgument="Delete" CommandName="Delete" Text="Remove" UniqueName="column">

     

     

     

    </telerik:GridButtonColumn>

     

     

     

    </Columns>

     

     

     

    <EditFormSettings>

     

     

     

    <EditColumn UniqueName="EditCommandColumn1">

     

     

     

    </EditColumn>

     

     

     

    </EditFormSettings>

     

     

     

    </MasterTableView>

     

     

    </

     

    telerik:RadGrid>

     

     

     

  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 18 Sep 2009 Link to this post

    Hi Eduardo,

    The main purpose of AJAX manager is to ajaxify all controls that normally work with postbacks and to make only partial updates of the page.
    To exclude controls from ajaxifying you can use OnRequestStart client-side event handler to determine the AJAX initiator and disable AJAX for the current request. The event is fired on each request so on the next one the same check will be performed. A similar implementation is often used in case of exporting from AJAXified Grid:

    Export RadGrid content to Excel/Word/CSV/PDF with Ajax enabled


    All the best,
    Mira
    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. Ed Molieri
    Ed Molieri avatar
    3 posts
    Member since:
    Sep 2009

    Posted 18 Sep 2009 Link to this post

    The issue that I'm having is that my submit button isn't posting back when I assign it to the manager.  I need for it to post back and have my grid reload (ajaxified)
  5. Answer
    Mira
    Admin
    Mira avatar
    1124 posts

    Posted 24 Sep 2009 Link to this post

    Hi Eduardo,

    I am attaching a sample project in which a grid is reloaded on button click after client side validation. You should use:
    OnClientClick="if (!Validate()) return false;" 
    for the button to postback successfully if Validate() returns true.

    For more information please take a look at the Client confirmation and AJAX help topic.

    Best wishes,
    Mira
    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.
Back to Top