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

RadAjaxManager + multiple events in listview

1 Answer 80 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Vincent asked on 05 Jun 2020, 10:07 AM

Hi !

Is the first time i've got this problem and i'm sure is not unique for my next years.

Explanations :

A listview (with 5 records for example) generate 5 rows with link, data and buttons(full postback) and 2 buttons for ajaxPostback.

<asp:ListView runat="server" ID="lvTest" OnItemCommand="lvTest_ItemCommand" DataKeyNames="Idkey" >  

2 buttons : 
- One :

CommandArgument='<%#Eval("MyIDForTreatment1") %>' CommandName="CmNameButton1"

- Second : 

CommandArgument='<%#Eval("MyIDForTreatment2") %>' CommandName="CmNameButton2"

RadAjaxManager (conditional is for specifics button for fullpostback (example : download document):

<telerik:RadAjaxManager ID="RAM1" runat="server" UpdatePanelsRenderMode="Inline" ClientEvents-OnRequestStart="conditionalPostback" >
<telerik:AjaxSetting AjaxControlID="lvTest" EventName="ItemCommand">
<telerik:AjaxUpdatedControl ControlID="Zone1" />  

 in code behind :

Protected Sub lvTest_ItemCommand(sender As Object, e As ListViewCommandEventArgs) 
   Case "CmNameButton1"
             'update content of zone 1 and visible true
   Case "CmNameButton2"
             'update content of zone 2 and visible true
   End Select
End Sub

 how to specify if i click on button1 : update Zone1
 how to specify if i click on button2 : update Zone2
 can't set commandName in AjaxSetting eventname ? for distinguished sender event ?



thanks for your help !

1 Answer, 1 is accepted

Sort by
Attila Antal
Telerik team
answered on 10 Jun 2020, 07:42 AM

Hi Vincent,

We have an in-depth explanation on how AJAX works and it needs to be implemented, see Understanding AJAX Controls.

For the scenario you have described, you will need to utilize the Client-side Programming of the RadAjaxManager by calling the ajaxRequest("someArguments") method when clicking on a button. With this scenario, you will need to enable RadAjaxManager as the AjaxControl, Zone1, and Zone1 as UpdatedControls. Depending on the AjaxRequest argument, you may update a specific zone at a time of clicking the button. Buttons must not do PostBack or otherwise, it will interrupt the client-side Logic.

Kind regards,
Attila Antal
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Asked by
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question