Buttons Not Excluded within Ajax

3 posts, 0 answers
  1. Art Handy
    Art Handy avatar
    11 posts
    Member since:
    Jun 2005

    Posted 27 May 2011 Link to this post

    I have been trying everthing to get this to work! However, the btnBibleBook button is not being exclued from the Ajax container. Therefor the routine I have attached to the button is not functioning properly. I have created a function, "conditionalPostback" that should be excluding the btnBibleBook button from the Ajax framework. It does not appear to be triggering properly. There is quite a bit of code here, but I didn't want to leave anything out. I did not include the Codebehind, but if anyone thinks it is necessary I will include it. Here is the Code:
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Copy of TheBible.aspx.vb" Inherits="BibleResources_TheBible" %>
      
    <%@ Register Src="~/Gadgets/Header.ascx" TagName="Header" TagPrefix="wisc" %>
    <%@ Register Src="~/Gadgets/Footer.ascx" TagName="Footer" TagPrefix="wisc" %>
    <%@ Register Src="~/Gadgets/SocialNetworks.ascx" TagName="SocialNetworks" TagPrefix="wisc" %>
    <%@ Register Src="~/Gadgets/QuestionsGadget.ascx" TagName="QuestionsGadget" TagPrefix="wisc" %>
    <%@ Register Src="~/Gadgets/ContentVoterGadget.ascx" TagName="ContentVoterGadget"
        TagPrefix="wisc" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title>Scripture Seeds - The Holy Bible</title>
        <meta content="Scripture Seeds Foundation" name="Tybee_Island" />
        <meta content="The Scripture Seeds Foundation is a bible-based, Christian outreach and evangelistic foundation dedicated to spreading the truth of God's Word."
            name="description" />
        <meta content="The Scripture Seeds Foundation believes that faith comes by hearing the Word of God."
            name="abstract" />
        <meta content="christian, bible, word, Gods Word, authority, creed, doctrine, guide, guidebook, handbook, manual, sacred writ, sacred writings, scripture, old testament, new testament, good news"
            name="keywords" />
        <meta content="Wireless Information Systems Corp., www.wirelessinfosys.com" name="author" />
        <meta content="Copyright © 2011 Scripture Seeds Foundation, All Rights Reserved"
            name="copyright" />
        <meta content="index,follow" name="robots" />
        <link rel="shortcut icon" href="~/images/papyrus.ico" type="image/x-icon" />
        <link rel="icon" href="~/images/papyrus.ico" type="image/x-icon" />
        <link href="~/App_Themes/Seeds/Scripture.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="frmBibleBooks" runat="server" style="text-align: center">
        <table id="tblBorder" align="center" cellpadding="0" cellspacing="0" border="0" width="975px">
            <tr>
                <td>
                    <div class="page">
                        <wisc:Header ID="ctlHeader" runat="server" />
                        <table id="tblFrame" align="center" cellpadding="2" cellspacing="0" border="1" width="100%">
                            <tr>
                                <td>
                                    <div id="PageContent" align="center">
                                        <table id="tblMain" runat="server" cellpadding="4" width="100%" align="center" border="0">
                                            <tr>
                                                <td id="LeftCol">
                                                    <wisc:ContentVoterGadget ID="ctlContentVoterGadget" runat="server" />
                                                </td>
                                                <td id="MainCol">
                                                    <table id="tblCenterCol" runat="server" cellpadding="6" width="100%" align="center"
                                                        border="1">
                                                        <tr>
                                                            <td id="colContent">
                                                                <h1>
                                                                    The Holy Bible</h1>
                                                                <div style="margin-left: 75px; margin-right: 20px;">
                                                                    <b style="color: #95c9f3;">THE OLD TESTAMENT<br />
                                                                    </b>There are 39 books in the Old Testament, generally separated into 4 divisions:
                                                                    <ol>
                                                                        <li>The Pentateuch (5 Books), traditionally designated as the 5 books of Moses.
                                                                        </li>
                                                                        <li>Historical Books (12 Books), from Joshua to Esther. </li>
                                                                        <li>Poetical Books (5 Books), from Job to Song of Solomon. </li>
                                                                        <li>Prophetical Books (17 Books), including the writings of the 5 Major Prophets, from
                                                                            Isaiah to Daniel, and the 12 Minor Prophets from Hosea to Malachi. </li>
                                                                    </ol>
                                                                    <br />
                                                                    <b style="color: #95c9f3;">THE NEW TESTAMENT<br />
                                                                    </b>There are 27 books in the New Testament, generally separated into 4 divisions:
                                                                    <ol>
                                                                        <li>The Gospels (4 Books), from Matthew to John.</li>
                                                                        <li>Historical Books (1 Book), Acts.</li>
                                                                        <li>Doctrinal Books (21 Books), from Romans to Jude. </li>
                                                                        <li>Prophetical Book (1 Book), Revelation.</li>
                                                                    </ol>
                                                                </div>
                                                                <p>
                                                                     </p>
                                                                <div>
                                                                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="conditionalPostback">
                                                                        <AjaxSettings>
                                                                            <telerik:AjaxSetting AjaxControlID="lvBibles">
                                                                                <UpdatedControls>
                                                                                    <telerik:AjaxUpdatedControl ControlID="lvBibles" LoadingPanelID="panReLoadBooks" />
                                                                                </UpdatedControls>
                                                                            </telerik:AjaxSetting>
                                                                        </AjaxSettings>
                                                                    </telerik:RadAjaxManager>
                                                                    <script type="text/javascript">
                                                                        function conditionalPostback(sender, args) {
                                                                            var theRegexp = new RegExp("\.btnBibleBook$", "ig");
                                                                            if (args.get_eventTarget().match(theRegexp)) {
                                                                                args.set_enableAjax(false);
                                                                            }
                                                                        }
                                                                    </script>
                                                                    <telerik:RadAjaxLoadingPanel ID="panReLoadBooks" runat="server" Transparency="30"
                                                                        EnableSkinTransparency="false" BackColor="#E0E0E0">
                                                                        <asp:Image ID="imgLoading" runat="server" ImageUrl="~/Images/sm_loading.gif" Width="60px"
                                                                            Style="border: 0px;" AlternateText="Loading..." ToolTip="Loading..." />
                                                                    </telerik:RadAjaxLoadingPanel>
                                                                    <div>
                                                                        <asp:Panel ID="panBooks" runat="server">
                                                                            <asp:Label ID="lblDataSource" runat="server" Visible="false"></asp:Label>
                                                                            <div align="center">
                                                                                <span style="vertical-align: middle; font-weight: bold; padding-left: 5px;">Bible Listing:</span>
                                                                                <asp:DropDownList ID="ddlBibleList" runat="server" AutoPostBack="True" ToolTip="Listing of Bible Books and Categories."
                                                                                    SelectedIndexChanged="ddlBibleList_SelectedIndexChanged">
                                                                                </asp:DropDownList>
                                                                            </div>
                                                                            <div align="center">
                                                                                <asp:RadioButtonList ID="optSortField" runat="server" RepeatDirection="Horizontal"
                                                                                    AutoPostBack="true">
                                                                                    <asp:ListItem Text="Name" Value="Book_Name" />
                                                                                    <asp:ListItem Text="Category" Value="Book_Category" />
                                                                                    <asp:ListItem Text="Testament" Value="Book_Testament" />
                                                                                    <asp:ListItem Selected="True" Value="Bible_ID">Bible Order</asp:ListItem>
                                                                                </asp:RadioButtonList>
                                                                                <div style="padding-left: 3px">
                                                                                    <p>
                                                                                    </p>
                                                                                    <span style="color: black;">Sort expression: </span>
                                                                                    <asp:Label ID="lblExpression" runat="server" Text=" " />
                                                                                </div>
                                                                            </div>
                                                                            <div align="center">
                                                                                <asp:Button ID="btnASC" runat="server" Width="122px" Text="Ascending" OnClick="btnASC_Click" />
                                                                                <asp:Button ID="btnDSC" runat="server" Width="122px" Text="Descending" OnClick="btnASC_Click" />
                                                                                <asp:Button ID="btnNone" runat="server" Width="122px" Text="None" OnClick="btnASC_Click" />
                                                                            </div>
                                                                            <telerik:RadListView ID="lvBibles" runat="server" ItemPlaceholderID="BookContainer"
                                                                                AllowPaging="True" PageSize="12" DataKeyNames="Book_ID" Font-Names="Calibri,Helvetica,Verdana,Arial,Serif"
                                                                                Font-Size="12px" OnItemEditing="DownLoadPDF">
                                                                                <LayoutTemplate>
                                                                                    <fieldset id="RadListView" style="float: left; width: 97%;">
                                                                                        <legend>Bible Books</legend>
                                                                                        <asp:PlaceHolder ID="BookContainer" runat="server" />
                                                                                        <div style="clear: both" />
                                                                                        <div style="padding: 5px;">
                                                                                            <div style="float: left; margin-left: 30%;">
                                                                                                <asp:Button runat="server" ID="btnFirst" CommandName="Page" CommandArgument="First"
                                                                                                    Text="First" Enabled="<%#Container.CurrentPageIndex > 0 %>" />
                                                                                                <asp:Button runat="server" ID="btnPrev" CommandName="Page" CommandArgument="Prev"
                                                                                                    Text="Prev" Enabled="<%#Container.CurrentPageIndex > 0 %>" />
                                                                                                <span style="vertical-align: middle;">  Page <strong>
                                                                                                    <%#Container.CurrentPageIndex + 1%></strong> of <strong>
                                                                                                        <%#Container.PageCount%>  </strong></span>
                                                                                                <asp:Button runat="server" ID="btnNext" CommandName="Page" CommandArgument="Next"
                                                                                                    Text="Next" Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" />
                                                                                                <asp:Button runat="server" ID="btnLast" CommandName="Page" CommandArgument="Last"
                                                                                                    Text="Last" Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" />
                                                                                            </div>
                                                                                            <div>
                                                                                                <span style="vertical-align: middle; font-weight: bold; padding-left: 5px;">Page Size:</span>
                                                                                                <telerik:RadComboBox runat="server" ID="cmbPageSize" OnSelectedIndexChanged="cmbPageSize_SelectedIndexChanged"
                                                                                                    AutoPostBack="true" Width="40px" SelectedValue="<%#lvBibles.PageSize %>" Skin="Black">
                                                                                                    <Items>
                                                                                                        <telerik:RadComboBoxItem Text="2" Value="2" />
                                                                                                        <telerik:RadComboBoxItem Text="4" Value="4" />
                                                                                                        <telerik:RadComboBoxItem Text="6" Value="6" />
                                                                                                        <telerik:RadComboBoxItem Text="8" Value="8" />
                                                                                                        <telerik:RadComboBoxItem Text="10" Value="10" />
                                                                                                        <telerik:RadComboBoxItem Text="12" Value="12" />
                                                                                                        <telerik:RadComboBoxItem Text="14" Value="14" />
                                                                                                    </Items>
                                                                                                </telerik:RadComboBox>
                                                                                            </div>
                                                                                        </div>
                                                                                    </fieldset>
                                                                                </LayoutTemplate>
                                                                                <ItemTemplate>
                                                                                    <fieldset style="float: left; width: 97%; height: 300px; background-color: Gray;">
                                                                                        <legend><b>Title</b>: <span style="color: #000000; font-weight: bold;">
                                                                                            <%#Eval("Book_Name")%></span> </legend>
                                                                                        <div class="details">
                                                                                            <div class="photo-container">
                                                                                                <telerik:RadBinaryImage runat="server" ID="bBinSermon" DataValue='<%#Eval("Book_Image") %>'
                                                                                                    AutoAdjustImageControlSize="false" Height="65px" ToolTip='<%#Eval("Book_Name", "Book of {0}") %>'
                                                                                                    AlternateText='<%#Eval("Book_Name", "Book of {0}") %>' BorderColor="White" BorderStyle="Solid"
                                                                                                    BorderWidth="3px" />
                                                                                            </div>
                                                                                            <div class="data-container">
                                                                                                <ul>
                                                                                                    <li>
                                                                                                        <label>
                                                                                                            <b style="color: Gray;">Testament:</b> <span style="color: #95c9f3;"><%#GetTestament(Eval("Book_Testament"))%></span></label></li>
                                                                                                    <li>
                                                                                                        <label>
                                                                                                            <b style="color: Gray;">Book:</b> <span style="color: #daa838;"><%#Eval("Book_Name")%></span></label></li>
                                                                                                    <asp:TextBox ID="txtName" runat="server" Visible="false" Text='<%#Eval("Book_Name")%>'></asp:TextBox>
                                                                                                    <asp:TextBox ID="txtID" runat="server" Visible="false" Text='<%#Eval("Book_ID")%>'></asp:TextBox>
                                                                                                    <li>
                                                                                                        <label>
                                                                                                            <b style="color: Gray;">Category:</b> <%#Eval("Book_Category")%></label><br />
                                                                                                        <br />
                                                                                                        <br />
                                                                                                        <br />
                                                                                                    </li>
                                                                                                    <li>
                                                                                                        <label>
                                                                                                            <b style="color: Gray;">Summary: </b>
                                                                                                        </label>
                                                                                                        <label>
                                                                                                            <span style="font-weight: normal; text-align: justify; font-size: 12px; font-family: Calibri, Helvetica, Verdana, Arial, Serif;">
                                                                                                                <%#TrimSummary(Eval("Book_Description"))%></span>
                                                                                                        </label>
                                                                                                    </li>
                                                                                                </ul>
                                                                                                <br />
                                                                                                <br />
                                                                                                <div align="center">
                                                                                                    <asp:Button ID='btnBibleBook' runat="server" Text='<%#GetPDF(Eval("Book_Name"), Eval("Book_ID"))%>'
                                                                                                        CommandName="Edit" CausesValidation="false" />
                                                                                                </div>
                                                                                            </div>
                                                                                        </div>
                                                                                    </fieldset>
                                                                                </ItemTemplate>
                                                                            </telerik:RadListView>
                                                                        </asp:Panel>
                                                                    </div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td id="RightCol" valign="top">
                                                    <wisc:SocialNetworks ID="ctlSocialNetworks" runat="server" />
                                                </td>
                                            </tr>
                                        </table>
                                        <asp:Label ID="lblError" runat="server" CssClass="ErrorMessageDB"></asp:Label>
                                    </div>
                                </td>
                            </tr>
                        </table>
                        <wisc:Footer ID="ctlFooter" runat="server" />
                    </div>
                </td>
            </tr>
        </table>
        </form>
    </body>
    </html>

    I would sure appreciate anyones help on this. In the codebehind routine "DownLoadPDF" fires and calls the external routine which forces a PDF to be downloaded, but because of the AJax the external routine errors out and the file is not downloaded.
    If I remove All the Ajax, the application functions properly.
  2. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 31 May 2011 Link to this post

    Hello Art,

    Could you please try to ajaxify the Panel instead the RadListView as shown below:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="conditionalPostback">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="panBooks">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panBooks" LoadingPanelID="panReLoadBooks" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    I hope this helps.

    Best regards,
    Daniel
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Art Handy
    Art Handy avatar
    11 posts
    Member since:
    Jun 2005

    Posted 31 May 2011 Link to this post

    Wow Daniel, that was simple. Thanks so much. It works like a champ now!
Back to Top