Postback not firing for radiobuttonlist

7 posts, 0 answers
  1. Bill
    Bill avatar
    175 posts
    Member since:
    Apr 2010

    Posted 09 Mar 2011 Link to this post

    I have a radiobuttonlist which is a trigger for three other controls. The issue I am having is that the OnSelectedIndexChanged event is not firing the second time around. This means that the rest of the controls encompassed by the trigger doesn't update.

    I need help determing why the three controls are not being updated by Ajax the second time around. Notice the boldfaced items which are the key to getting this to work.

    If I remove the AJAX manager, the controls get updated successfully the second time around, but you can see the postback occurring in the browser which I ultimately don't want to see. 

    Here is my html:
    <code>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rblDataType">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lstPatientEDLogs" />
                    <telerik:AjaxUpdatedControl ControlID="pnlNoPatientInfoCounts" />
                    <telerik:AjaxUpdatedControl ControlID="pnlPatientInfoCounts" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    </code>

    <code>
    <asp:Panel ID="pnlData" runat="server" GroupingText="Data Type for DOS" Width="1100px">
                        <asp:RadioButtonList ID="rblDataType" RepeatDirection="Horizontal" TextAlign="Right"
                            runat="server" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="rblDataType_SelectedIndexChanged">
                            <asp:ListItem Text="No Patient Info" Selected="True"></asp:ListItem>
                            <asp:ListItem Text="Patient Info"></asp:ListItem>
                            <asp:ListItem Text="Visit Info" Enabled="false"></asp:ListItem>
                        </asp:RadioButtonList>
                    </asp:Panel>
    </code>

    <code>
    <asp:Panel ID="pnlNoPatientInfoCounts" runat="server" GroupingText="No Patient Info Count"
                        Width="1100px">
                        <table>
                            <tr>
                                <td>
                                    <asp:Label ID="lblDataNETCnt1" runat="server" Text="DataNET: "></asp:Label>
                                    <asp:Label ID="lblDataNETCntData1" runat="server" Text="0"></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblDataNET_PendingCnt1" runat="server" Text="DataNET/Pending: "></asp:Label>
                                    <asp:Label ID="lblDataNET_PendingCntData1" runat="server" Text="0"></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblDataNET_DeficientCnt1" runat="server" Text="DataNET/Deficient: "></asp:Label>
                                    <asp:Label ID="lblDataNET_DeficientCntData1" runat="server" Text="0"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
    </code>

    </code>
    <asp:Panel ID="pnlPatientInfoCounts" runat="server" GroupingText="Patient Info Count"
                        Width="1100px">
                        <table>
                            <tr>
                                <td>
                                    <asp:Label ID="lblDataNET_PendingCnt2" runat="server" Text="DataNET/Pending: "></asp:Label>
                                    <asp:Label ID="lblDataNET_PendingCntData2" runat="server" Text="0"></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblDataNET_DeficientCnt2" runat="server" Text="DataNET/Deficient: "></asp:Label>
                                    <asp:Label ID="lblDataNET_DeficientCntData2" runat="server" Text="0"></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblCodeNETCnt2" runat="server" Text="CodeNET: "></asp:Label>
                                    <asp:Label ID="lblCodeNETCntData2" runat="server" Text="0"></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblCodeNET_PendingCnt2" runat="server" Text="CodeNET/Pending: "></asp:Label>
                                    <asp:Label ID="lblCodeNET_PendingCntData2" runat="server" Text="0"></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblCodeNET_DeficientCnt2" runat="server" Text="CodeNET/Deficient: "></asp:Label>
                                    <asp:Label ID="lblCodeNET_DeficientCntData2" runat="server" Text="0"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
    </code>

    Here is my server side code-behind: This is the code that changes the other three controls. However, when the index is changed for the radiobuttonlist, the second time around, a postback is never fired. It gets hit the first time I change the index of the radiobuttonlist, but not the second time.
    <code>
    protected void rblDataType_SelectedIndexChanged(Object sender, EventArgs e)
            {
                LoadDatesofSvc();
            }
    </code>
  2. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 14 Mar 2011 Link to this post

    Hello William,

    RadioButtonList has some specifics related to ajaxifying due to which you need to add it to the updated controls in order for it to behave as expected:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
      <AjaxSettings>
         <telerik:AjaxSetting AjaxControlID="rblDataType">
           <UpdatedControls>
             <telerik:AjaxUpdatedControl ControlID="lstPatientEDLogs" />
             <telerik:AjaxUpdatedControl ControlID="pnlNoPatientInfoCounts" />
             <telerik:AjaxUpdatedControl ControlID="pnlPatientInfoCounts" />
             <telerik:AjaxUpdatedControl ControlID="rblDataType" />
           </UpdatedControls>
         </telerik:AjaxSetting>
      </AjaxSettings>
    </telerik:RadAjaxManager>


    All the best,
    Tsvetina
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bill
    Bill avatar
    175 posts
    Member since:
    Apr 2010

    Posted 15 Mar 2011 Link to this post

    Thanks... That worked fine...
  5. Jaspreet
    Jaspreet avatar
    3 posts
    Member since:
    Aug 2011

    Posted 12 Aug 2011 Link to this post

    Hi,

    I have the postback problem for RadioButtonList even if it's being added to AjaxUpdatedControl it isn't working. In my case the postback isn't working at all even for 1st time. Please respond.

    Thanks
    Jaspreet Singh Sohal
  6. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 15 Aug 2011 Link to this post

    Hello Jaspreet,

    Please, paste your code, so that we can look for possible mistakes and if needed test it locally.

    Best wishes,
    Tsvetina
    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.

  7. Jaspreet
    Jaspreet avatar
    3 posts
    Member since:
    Aug 2011

    Posted 16 Aug 2011 Link to this post

    Environment :- VS2010, target framework :4.0
    Telerik version :- RadControls for ASP.NET Q2 2008

    Code:-
    Test1.aspx
    ------------------------

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test1.aspx.cs" Inherits="Test1" %>
    <%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

    <!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></title>   
    </head>
    <body>
        <form id="form1" runat="server">   
         <rad:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>              
                    <rad:AjaxSetting AjaxControlID="RadioButtonList1">
                        <UpdatedControls>
                            <rad:AjaxUpdatedControl ControlID="Panel1" />  
                             <rad:AjaxUpdatedControl ControlID="RadioButtonList1" />                       
                        </UpdatedControls>
                    </rad:AjaxSetting>             
                </AjaxSettings>
            </rad:RadAjaxManager>
         <asp:Panel ID="Panel2" runat="server"  >
            <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
                <asp:ListItem  Value="Visible">Visible</asp:ListItem>
                <asp:ListItem Value="NotVisible">Not Visible</asp:ListItem>
            </asp:RadioButtonList>
         </asp:Panel>              
            <asp:Panel ID="Panel1" runat="server" Height="95px" Width="244px">
                <asp:Image ID="Image1" runat="server" ImageUrl="http://www.telerik.com/images/Homepage/TelerikLogo.gif"
                    Visible="False" />
            </asp:Panel>  
        </form>
    </body>
    </html>

    Test1.aspx.cs
    --------------------------

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public partial class Test1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
      
        protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Image1.Visible = RadioButtonList1.SelectedValue.Equals("Visible");
        }
       
    }


    Issue;-
    A break point to RadioButtonList1_SelectedIndexChanged never hits.

  8. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 18 Aug 2011 Link to this post

    Hi Jaspreet,

    I tested this with the latest version of RadControls and it works as expected, as you can see in the video below:
    http://screencast.com/t/6jMoHfzoJHRu

    I would advise you to update your RadControls version in order to have the problem fixed. Alternatively, you could try using UpdatePanels for this specific scenario.

    Kind regards,
    Tsvetina
    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.

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