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

Update detail controls only at SelectedIndexChanged event of the Grid

3 Answers 52 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Danny Scheelings
Top achievements
Rank 1
Danny Scheelings asked on 07 Oct 2009, 02:28 PM
Hi,

I have a page with a RadGrid and below the grid a Panel with Detail controls. The Grid is filled with Employees. When I select an Employee the Panel with Detail controls must be filled with Employee details.

I am using the RadAjaxManager to Ajaxify this page. I added an AjaxSetting with the Grid as the AjaxControl and the Panel as the AjaxUpdatedControl. All this works but the Panel is updated at each event of the Grid (Sorting, FIltering, Selecting, etc.). I want that the Panel is only updated when the SelectedIndexChanged event of the Grid occurs.

Is there a way to specifiy Events in the AjaxManager?
Or is there a way to Update controls from the server, even when they are not Ajaxified in the first place (like the Update method of the AJAX.NET UpdatePanel)?

Thanks,
Danny

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 12 Oct 2009, 08:13 AM
Hello Danny,

Unfortunately this is not possible since all postback requests from the control you specify as an initiator of the ajax request become triggers for updates. However, you may consider the solution to make the manager itself an initiator and the grid updated control and use the ajaxRequest(args) method of the manager on client grid selection (setting its ClientSettings -> Selecting -> AllowRowSelect property to true and intercepting the OnRowSelected event of the control) to refresh the details.
 
Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Danny Scheelings
Top achievements
Rank 1
answered on 14 Oct 2009, 08:14 AM
Hi Sebastian,

Thanks for your reply.
I understand your solution but I do not know how to program this. Can you give me a little example?

Thanks,
Danny
0
Accepted
Sebastian
Telerik team
answered on 14 Oct 2009, 12:41 PM
Hello Danny,

Here are some pseudo code snippets that should get you started (assuming that the ids of the ajax manager and the grid are RadAjaxManager1 and RadGrid1 respectively and the grid is populated from the Northwind Customers database):

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadGrid id="RadGrid1" runat="server">
 <MasterTableView ClientDataKeyNames="CustomerID" DataKeyNames="CustomerID" ....>
 </MasterTableView
</telerik:RadGrid>


<telerik:RadCodeBlock id="RadCodeBlock1" runat="server">
  <script type="text/javascript">
    function RowSelected(sender, eventArgs)
    {
       $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest(eventArgs.getDataKeyValue("CustomerID"));
    
  </script>
</telerik:RadCodeBlock>

//Intercept the OnAjaxRequest server event of the manager, get the CustomerID value from e.Argument parameter and execute your custom logic based on it

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Ajax
Asked by
Danny Scheelings
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Danny Scheelings
Top achievements
Rank 1
Share this question
or