RadAjaxPanel causes full post back

Thread is closed for posting
2 posts, 0 answers
  1. Alan
    Alan avatar
    1 posts
    Member since:
    Oct 2011

    Posted 17 Oct 2011 Link to this post

    Hi,

    I'm very new to Telerik controls. Today I tried to get RadAjaxPanel to postback part of the page but cound't get it to do so. Can anyone please indicate what I am doing wrong. For the sake of simplicity I've added some text to the top of the page so as to make the page refresh more visible.

    Below is the code using controls that come with .NET

    <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head id="Head1" runat="server">
        <script runat="server">
            protected void ReadOnly_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (ReadOnly.SelectedItem.Value == "Yes")
                    Details.ReadOnly = false;
                else
                {
                    Details.Text = "";
                    Details.ReadOnly = true;
                }
            }
        </script>
        <title></title>
    </head>
    <body>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
        <form id="Form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            Read Only:
            <asp:DropDownList ID="ReadOnly" runat="server" OnSelectedIndexChanged="ReadOnly_SelectedIndexChanged"
                AutoPostBack="True">
                <asp:ListItem Selected="True">No</asp:ListItem>
                <asp:ListItem>Yes</asp:ListItem>
            </asp:DropDownList>
            <br />
            <br />
            Details:
            <asp:TextBox ID="Details" runat="server" Columns="60" Rows="5" TextMode="MultiLine"
                ReadOnly="True"></asp:TextBox>
    </ContentTemplate>
        </asp:UpdatePanel>
        </form>
    </body>
    </html>

    What follows is the Telerik equivalent that isn't working.

    <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" %>
     
    <%@ 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">
    <head id="Head1" runat="server">
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    RadAjaxPanel2.EnableAJAX = false;
                }
            }
     
            protected void ReadOnly_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (ReadOnly.SelectedItem.Value == "Yes")
                    Details.ReadOnly = false;
                else
                {
                    Details.Text = "";
                    Details.ReadOnly = true;
                }
            }
        </script>
        <title></title>
    </head>
    <body>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
        <form id="Form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            Read Only:
            <asp:DropDownList ID="ReadOnly" runat="server" OnSelectedIndexChanged="ReadOnly_SelectedIndexChanged"
                AutoPostBack="True">
                <asp:ListItem Selected="True">No</asp:ListItem>
                <asp:ListItem>Yes</asp:ListItem>
            </asp:DropDownList>
            <br />
            <br />
            Details:
            <asp:TextBox ID="Details" runat="server" Columns="60" Rows="5" TextMode="MultiLine"
                ReadOnly="True"></asp:TextBox>
        </telerik:RadAjaxPanel>
        </form>
    </body>
    </html>
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 20 Oct 2011 Link to this post

    Hi Alan,

    I reviewed your code and observed that you are in fact disabling ajax. Can you remove the code from the Page_Load event handler and see if it makes any difference?

    Regards,
    Iana Tsolova
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top