OnInserted/OnDeleted not Firing

4 posts, 0 answers
  1. Rodney
    Rodney avatar
    40 posts
    Member since:
    Mar 2015

    Posted 20 Jun Link to this post

    I have the following two RadListBoxes defined to allow switching items between them. All was well until I defined OnInserted and OnDelted, which fail to fire.

    I  need to take action when anything is added to or removed from the right list box. This is they only way I'm aware of doing it, but like I said the events don't fire.

    Here's the associated code:

    <telerik:RadListBox runat="server" ID="rlbxAvailableRoles" Height="210" Width="230" AllowTransfer="true" TransferToID="rlbxSelectedRoles"
        ButtonSettings-AreaWidth="35px" AllowTransferOnDoubleClick="true" ButtonSettings-ShowTransferAll="false">
        <HeaderTemplate>
            <h3>Available Roles</h3>
        </HeaderTemplate>
    </telerik:RadListBox>
    <telerik:RadListBox runat="server" ID="rlbxSelectedRoles" Height="210" Width="190" EmptyMessage="Select at least one role"
        OnInserted="rlbxSelectedRoles_Inserted" OnDeleted="rlbxSelectedRoles_Deleted">
        <HeaderTemplate>
            <h3>Selected Roles</h3>
        </HeaderTemplate>
    </telerik:RadListBox>

    protected void rlbxSelectedRoles_Inserted(object sender, RadListBoxEventArgs e)
    {
        LoadPrimaryRoleDropdown();
    }
     
    protected void rlbxSelectedRoles_Deleted(object sender, RadListBoxEventArgs e)
    {
        LoadPrimaryRoleDropdown();
    }

     

     

    Any help would be appreciated

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    832 posts

    Posted 23 Jun Link to this post

    Hello Rodney,

    In order for the OnInserted event to fire for the destination ListBox the source ListBox must have its AutoPostBackOnTransfer property set to "true". The property needed for the OnDeleted event to fire is: AutoPostBackOnDelete, so in addition to subscribing the destination ListBox(rlbxSelectedRoles) to the event you need to set its AutoPostBackOnDelete property to "true".
    You can find more information on the conditions, under which the server events fire in the Server-side programming section of the documentation.

    Regards,
    Ivan Danchev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rodney
    Rodney avatar
    40 posts
    Member since:
    Mar 2015

    Posted 23 Jun Link to this post

    Thank you. 

     Such an easy solution.

    Rodney

  5. Ivan Danchev
    Admin
    Ivan Danchev avatar
    832 posts

    Posted 27 Jun Link to this post

    Hello Rodney,

    Thank you for getting back to us. I am glad using the suggested values of the ListBox properties led to the corresponding server-side events firing as expected.

    Regards,
    Ivan Danchev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top