This is a migrated thread and some comments may be shown as answers.

OnInserted/OnDeleted not Firing

3 Answers 123 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Rodney
Top achievements
Rank 2
Rodney asked on 20 Jun 2016, 06:10 PM

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

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 23 Jun 2016, 12:39 PM
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.
0
Rodney
Top achievements
Rank 2
answered on 23 Jun 2016, 06:25 PM

Thank you. 

 Such an easy solution.

Rodney

0
Ivan Danchev
Telerik team
answered on 27 Jun 2016, 10:38 AM
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.
Tags
ListBox
Asked by
Rodney
Top achievements
Rank 2
Answers by
Ivan Danchev
Telerik team
Rodney
Top achievements
Rank 2
Share this question
or