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

Add mulitple updated control at runtime

10 Answers 101 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 2
Andy Green asked on 02 Jul 2014, 11:42 AM
Hi all.

I have 2 trigger controls on my page but only on is set to visible at a time.

If I disable on control on the page the Ajax breaks.

Is it possible to progamatically disable the appropriate AjaxSetting, or how do I add multiple UpdatedCongtrols at runtime.

​ <telerik:AjaxSetting AjaxControlID="ddlLocation">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ddlSpecialty"/>
<telerik:AjaxUpdatedControl ControlID="ltlCapacity"/>
<telerik:AjaxUpdatedControl ControlID="rdDashboard"/>
</UpdatedControls>
</telerik:AjaxSetting>

<telerik:AjaxSetting AjaxControlID="ddlMyLocations">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ddlSpecialty"/>
<telerik:AjaxUpdatedControl ControlID="ltlCapacity"/>
<telerik:AjaxUpdatedControl ControlID="rdDashboard" />
</UpdatedControls>
</telerik:AjaxSetting>


Only one either ddlLocation or ddlMyLocation is set to visible on my page at a time.

Andy

10 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 02 Jul 2014, 02:54 PM
Hi Andy,

The best approach for adding invisible control into the RadAjaxManager settings is to wrap those controls into always visible containers (for example asp Panels) and add those containers to the Ajax setting instead of the controls which visibility is manipulated.
By using this approach you will could avoid the modifying of the Ajax settings programmatically.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Andy Green
Top achievements
Rank 2
answered on 02 Jul 2014, 04:30 PM
Thanks Maria

Seems a bit of a work around to me. I'll give it a try see how I get on.

Andy
0
Andy Green
Top achievements
Rank 2
answered on 03 Jul 2014, 09:18 AM
Just want to check I have this right as it doesn't work.

I have added a panel around each control where I change visibility, and replaced the control with the panel in the AJAX Manager

           <telerik:AjaxSetting AjaxControlID="pnlLocation">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="ddlSpecialty"/>
                   <telerik:AjaxUpdatedControl ControlID="ltlCapacity"/>
                   <telerik:AjaxUpdatedControl ControlID="rdDashboard"/>
               </UpdatedControls>
           </telerik:AjaxSetting>

           <telerik:AjaxSetting AjaxControlID="pnlMyLocations">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="ddlSpecialty"/>
                   <telerik:AjaxUpdatedControl ControlID="ltlCapacity"/>
                   <telerik:AjaxUpdatedControl ControlID="rdDashboard" />
               </UpdatedControls>
           </telerik:AjaxSetting>
 
These are the controls:

                                    <asp:Panel ID="pnlLocation" runat="server">
                                        <telerik:RadComboBox ID="ddlLocation" runat="server" Height="400px" Width="245px" ShowToggleImage="True" Style="vertical-align: middle;" OnClientDropDownOpened="DownOpenedHandlerLocation"  CausesValidation="False" EnableEmbeddedSkins="False" Skin="Activity" >
                                            <ItemTemplate>
                                                <div onclick="StopPropagation(event)">
                                                    <telerik:RadTreeView ID="rtvLocation" runat="server" EnableEmbeddedSkins="False" Skin="Activity" CausesValidation="true"  OnClientNodeClicking="nodeClickingLocation" >
                                                        <Nodes>
                                                            <telerik:RadTreeNode runat="server" Text="None" Value=""></telerik:RadTreeNode>
                                                        </Nodes>
                                                    </telerik:RadTreeView>
                                                </div>
                                            </ItemTemplate>
                                    
                                            <Items>
                                                <telerik:RadComboBoxItem Text="" />
                                            </Items>
                                        </telerik:RadComboBox>
                                    </asp:Panel>

                                    <asp:Panel ID="pnlMyLocation" runat="server">
                                        <telerik:RadComboBox ID="ddlMyLocations" runat="server" Height="200px" Width="245px" EnableEmbeddedSkins="false" Skin="Activity" AppendDataBoundItems="true" onclientselectedindexchanged="myLocationChange"></telerik:RadComboBox>
                                    </asp:Panel>

The page behaves in  the same way as with hidden controls.

Andy






0
Maria Ilieva
Telerik team
answered on 07 Jul 2014, 12:10 PM
Hi Andy,

If the provided suggestion did not help I would ask you to post the entire page markup as well as the related code behind so that we could further investigate on your application and do our best to provide proper solution.



Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Andy Green
Top achievements
Rank 2
answered on 07 Jul 2014, 12:51 PM
Thanks Maria

This is the page markup

<%@ Page Title="" Language="VB"  AutoEventWireup="false" CodeFile="Dashboard.aspx.vb" Inherits="GridViews_Dashboard"%>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register src="../Controls/Notifier.ascx" tagname="Notifier" tagprefix="uc1" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 
<head id="Head" runat="server">
    <title>Dashboard</title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1"/>
 
    <link href="~/App_Themes/Default/Slider.Activity.css" rel="stylesheet" type="text/css" runat="server"/>
    <link href="~/App_Themes/Default/Grid.Activity.css" rel="stylesheet" type="text/css" runat="server"/>
    <link href="~/App_Themes/Default/GridBorderOverride.css" rel="stylesheet" type="text/css"/>
    <link href="~/App_Themes/Default/ComboBox.Activity.css" rel="stylesheet" type="text/css" runat="server"/>
    <link href="~/App_Themes/Default/Window.Activity.css" rel="stylesheet" type="text/css" runat="server"/>
    <link href="~/App_Themes/Default/TreeView.Activity.css" rel="stylesheet" type="text/css" runat="server"/>
    <link href="~/App_Themes/Default/Menu.Activity.css" rel="stylesheet" type="text/css" runat="server"/>
    <link href="~/App_Themes/Default/Button.Activity.css" rel="stylesheet" type="text/css" runat="server"/>
    <link href="~/App_Themes/Default/Notification.Activity.css" rel="stylesheet" type="text/css" runat="server"/>
 
    <link href="~/App_Themes/Default/Layout.css" rel="stylesheet" type="text/css" runat="server" />
    <link href="~/App_Themes/Default/Styles.css" rel="stylesheet" type="text/css" runat="server" />
     
   <telerik:RadScriptBlock ID="RadScriptBlock" runat="server"
            <script src="../JavaScript/jquery-1.9.1.min.js"></script>
            <script type="text/javascript" src="../JavaScript/Modal.js"></script>
 
            <script type="text/javascript">
 
                function refreshGrid() {
                    $find("<%= AjaxManager.ClientID %>").ajaxRequest("Rebind");
                    restartTimer()
                    //StartTheTimer();
                }
 
                function myLocationChange() {
                    //alert("Boo");
                    $find("<%= AjaxManager.ClientID %>").ajaxRequest("LocationChange");
                      restartTimer()
                      //StartTheTimer();
                  }
 
                 function pauseTimer() {
                    var timer = $find('<%= tmrGridRefresh.ClientID %>');
                    timer._update(false, 45000);
                    //timer._stopTimer();
                }
 
                function restartTimer() {
                    var timer = $find('<%= tmrGridRefresh.ClientID %>');
                    if (!timer.get_enabled()) {
                        timer._update(true, 45000);
                        //timer._startTimer();
                    }
                }
 
                function SliderLoaded(sender, args) {
                    sender.repaint();
                    $get("txtSliderValueArrivals").value = sender.get_value();
                }
 
                function HandleValueChangedArrivals(sender, eventArgs) {
                    $get("txtSliderValueArrivals").value = sender.get_value();
                }
 
                function pageLoad() {
                    var comboBox = $find("<%= ddlLocation.ClientID %>");
                    var tree = comboBox.get_items().getItem(0).findControl("rtvLocation");
                    var selectedNode = tree.get_selectedNode();
                    if (selectedNode) {
                        comboBox.set_text(selectedNode.get_text());
                    }
                }
 
                function StopPropagation(e) {
                    if (!e) {
                        e = window.event;
                    }
                    e.cancelBubble = true;
                }
 
                function nodeClickingLocation(sender, args) {
                    var comboBox = $find("<%= ddlLocation.ClientID %>");
                    var node = args.get_node()
                    comboBox.set_text(node.get_text());
                    comboBox.trackChanges();
                    comboBox.get_items().getItem(0).set_value(node.get_text());
                    comboBox.get_items().getItem(0).get_attributes().setAttribute("nodeValue", node.get_value());
                    comboBox.commitChanges();
                    comboBox.hideDropDown();
                    $find("<%= AjaxManager.ClientID %>").ajaxRequest("LocationChange");
                }
 
                function DownOpenedHandlerLocation(sender, eventArgs) {
                    var tree = sender.get_items().getItem(0).findControl("rtvLocation");
                    var selectedNode = tree.get_selectedNode();
                    if (selectedNode) {
                        selectedNode.scrollIntoView();
                    }
                }
 
                function ShowDashboard(appointment_id, patient_id, location_id, specialty, patientlocation_id, status, tab, action) {
                    pauseTimer()
                    //StopTheClock();
                    var d = new Date();
                    var n = d.getMilliseconds();
                    var oWnd = radopen("../Modal/DashboardModal.aspx?Appointment_ID=" + appointment_id + "&Patient_ID=" + patient_id + "&Location_ID=" + location_id + "&Specialty=" + specialty + "&PatientLocation_ID=" + patientlocation_id + "&Status=" + status + "&Tab=" + tab + "&Action=" + action + "&stamp=" + n, "Actions", null);
                    oWnd.setSize(800, 550);
                    oWnd.set_modal(true);
                    return false;
                }
 
            </script>
 
   
   </telerik:RadScriptBlock
 
 
</head>
 
<body id="GridbodyMaster" runat="server">
 
 <form id="frmDashboard" runat="server">
     
   <telerik:RadScriptManager ID="ScriptManager" runat="server"></telerik:RadScriptManager>
 
   <telerik:RadAjaxManager ID="AjaxManager" runat="server" UpdatePanelsRenderMode="Inline" DefaultLoadingPanelID="LoadingPanel" OnAjaxRequest="AjaxManager_AjaxRequest">
       <AjaxSettings>
 
<%--       <telerik:AjaxSetting AjaxControlID="pnlFilters">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="pnlFilters"/>
               </UpdatedControls>
           </telerik:AjaxSetting>--%>
 
           <telerik:AjaxSetting AjaxControlID="pnlMyLocation">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="ddlSpecialty"/>
                   <telerik:AjaxUpdatedControl ControlID="ltlCapacity"/>
                   <telerik:AjaxUpdatedControl ControlID="rdDashboard" />
               </UpdatedControls>
           </telerik:AjaxSetting>
 
           <telerik:AjaxSetting AjaxControlID="pnlLocation">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="ddlSpecialty"/>
                   <telerik:AjaxUpdatedControl ControlID="ltlCapacity"/>
                   <telerik:AjaxUpdatedControl ControlID="rdDashboard"/>
               </UpdatedControls>
           </telerik:AjaxSetting>
 
           <telerik:AjaxSetting AjaxControlID="cblStatus">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="lblDuration"/>
                    <telerik:AjaxUpdatedControl ControlID="rdDashboard"/>
               </UpdatedControls>
           </telerik:AjaxSetting>
 
           <telerik:AjaxSetting AjaxControlID="rslTimeOffset">
                 <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="lblDuration"/>
                    <telerik:AjaxUpdatedControl ControlID="rdDashboard"/>
               </UpdatedControls>
           </telerik:AjaxSetting>
 
           <telerik:AjaxSetting AjaxControlID="rblTimeFilter">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="lblDuration"/>
                   <telerik:AjaxUpdatedControl ControlID="rdDashboard"/>
               </UpdatedControls>
           </telerik:AjaxSetting>
 
           <telerik:AjaxSetting AjaxControlID="btnRefresh">
               <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="pnlFilters" />
                   <telerik:AjaxUpdatedControl ControlID="lblDuration" />
                  <telerik:AjaxUpdatedControl ControlID="txtPatientName"/>
                  <telerik:AjaxUpdatedControl ControlID="rdDashboard"/>
               </UpdatedControls>
           </telerik:AjaxSetting>
       
           <telerik:AjaxSetting AjaxControlID="tmrGridRefresh">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="pnlFilters" />
                   <telerik:AjaxUpdatedControl ControlID="lblDuration" />
                   <telerik:AjaxUpdatedControl ControlID="rdDashboard" UpdatePanelCssClass="" />
               </UpdatedControls>
           </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rdDashboard">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlFilters" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="lblDuration" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="rdDashboard" UpdatePanelCssClass="" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="AjaxManager">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ddlSpecialty" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="ddlClinic" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="ltlCapacityLabel" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="ltlCapacity" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="chkAutoCall" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="lblAutoCallError" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="lblDuration" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="btnAddToList" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="btnRefresh" UpdatePanelCssClass="" />
                    <telerik:AjaxUpdatedControl ControlID="rdDashboard" UpdatePanelCssClass="" />
                </UpdatedControls>
            </telerik:AjaxSetting>
       </AjaxSettings>
   </telerik:RadAjaxManager>
 
    <telerik:RadWindowManager ID="WindowManager" runat="server"  EnableEmbeddedSkins="false" Skin="Activity" Behaviors="Close" VisibleStatusbar="false" ShowContentDuringLoad="false"></telerik:RadWindowManager>
    <uc1:Notifier ID="Notifier" runat="server" />
 
    <div class="GridHeader">
        <table class="Container" cellpadding="4" cellspacing="0">
            <tr>
                <td rowspan="3" >
                     
                    <asp:Panel ID="pnlFilters" runat="server">
                        <table cellpadding="4" cellspacing="1">
                            <tr>
                                <th>Location</th>
                                <th>Specialty</th>
                                <th>Status</th>
                                <th>Time scale (+ <input type="text" style="width: 15px;border:none; color:#666;" id="txtSliderValueArrivals" />hr(s))</th>
                                <th> </th>
                            </tr>
                            <tr  valign="top">
                                <td>
                                    <asp:Panel ID="pnlLocation" runat="server">
                                        <telerik:RadComboBox ID="ddlLocation" runat="server" Height="400px" Width="245px" ShowToggleImage="True" Style="vertical-align: middle;" OnClientDropDownOpened="DownOpenedHandlerLocation"  CausesValidation="False" EnableEmbeddedSkins="False" Skin="Activity" >
                                            <ItemTemplate>
                                                <div onclick="StopPropagation(event)">
                                                    <telerik:RadTreeView ID="rtvLocation" runat="server" EnableEmbeddedSkins="False" Skin="Activity" CausesValidation="true"  OnClientNodeClicking="nodeClickingLocation" >
                                                        <Nodes>
                                                            <telerik:RadTreeNode runat="server" Text="None" Value=""></telerik:RadTreeNode>
                                                        </Nodes>
                                                    </telerik:RadTreeView>
                                                </div>
                                            </ItemTemplate>
                                     
                                            <Items>
                                                <telerik:RadComboBoxItem Text="" />
                                            </Items>
                                        </telerik:RadComboBox>
                                    </asp:Panel>
 
                                    <asp:Panel ID="pnlMyLocation" runat="server">
                                        <telerik:RadComboBox ID="ddlMyLocation" runat="server" Height="200px" Width="245px" EnableEmbeddedSkins="false" Skin="Activity" AppendDataBoundItems="true" onclientselectedindexchanged="myLocationChange"></telerik:RadComboBox>
                                    </asp:Panel>
 
                                </td>
                                <td><telerik:RadComboBox ID="ddlSpecialty" runat="server" EnableEmbeddedSkins="false" Skin="Activity" Width="200px" emptyMessage="Click to change Specialties" CheckBoxes="true" OnClientBlur="refreshGrid"></telerik:RadComboBox></td>
                                <td rowspan="2"><asp:CheckBoxList ID="cblStatus" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" AutoPostBack="true" RepeatColumns="3"></asp:CheckBoxList></td>
                                <td rowspan="2"><telerik:RadSlider ID="rslTimeOffset" runat="server" OnClientValueChanged="HandleValueChangedArrivals" OnClientLoad="HandleValueChangedArrivals"  MinimumValue="0" MaximumValue="4" Value="1" Width="150px" AutoPostBack="true" EnableEmbeddedSkins="False" Skin="Activity"></telerik:RadSlider></td>
                                <td rowspan="2"> </td>
                            </tr>
                            <tr valign="top">
                            <th><asp:Label ID="lblConsultant" runat="server" Text="Clinician"></asp:Label></th>
                            <th>Clinic</th>
                            </tr>
                            <tr valign="top">
                            <td><telerik:RadComboBox ID="ddlConsultant" Runat="server" Width="245px" EnableEmbeddedSkins="false" Skin="Activity" CheckBoxes="true" emptyMessage="Click to change Clinician" OnClientBlur="refreshGrid"></telerik:RadComboBox></td>
                            <td><telerik:RadComboBox ID="ddlClinic" Runat="server" Width="200px" EnableEmbeddedSkins="false" Skin="Activity" CheckBoxes="true" emptyMessage="Click to change Clinics" OnClientBlur="refreshGrid"></telerik:RadComboBox></td>
                            <td><asp:RadioButtonList ID="rblTimeFilter" runat="server"  RepeatDirection="Horizontal" CellPadding="2" AutoPostBack="true" AppendDataBoundItems="true"></asp:RadioButtonList></td>
                            <td>
                                <asp:Literal ID="ltlCapacityLabel" runat="server" Visible="false">Capacity:</asp:Literal>
                                <asp:Literal ID="ltlCapacity" runat="server" Visible="false"></asp:Literal>
                                   
                                <asp:CheckBox ID="chkAutoCall" runat="server" Text="Auto Call" AutoPostBack="true" Visible="false" />
                                <asp:Label ID="lblAutoCallError" runat="server" Text="Auto Call Error" CssClass="dataerror" Visible="false"></asp:Label>
                            </td>
                                <td>
                                    <telerik:RadButton ID="rbResetParams" runat="server" Width="16px" Height="16px" ToolTip="Reset filters" AutoPostBack="true">
                                        <Image ImageUrl="~/App_Themes/Images/Refresh_16.png"></Image>
                                    </telerik:RadButton>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
 
                </td>
                   
                    <td align="right">
                        <asp:Label ID="lblDuration" runat="server" CssClass="Stats"></asp:Label>
                          
                        <div id="loading">
                            <telerik:RadAjaxLoadingPanel ID="LoadingPanel" runat="Server" IsSticky="true" >
                                <img alt="Loading..." src="../App_Themes/Images/loading6.gif"/>
                            </telerik:RadAjaxLoadingPanel>
                        </div>
                        <asp:HyperLink ID="lnkExpand" runat="server" NavigateUrl="~/Gridviews/Dashboard.aspx?fs=1" Target="_top" ImageUrl="../App_Themes/Images/Expand_16.png" ToolTip="Full Screen"></asp:HyperLink>
                        <asp:HyperLink ID="lnkCollapse" runat="server" NavigateUrl="~/Gridviews/Default.aspx?id=Dashboard" Target="_top" ImageUrl="../App_Themes/Images/Collapse_16.png" ToolTip="Normal Layout"></asp:HyperLink>
                    </td>
 
            </tr>
            <tr>
                    <td align="right">
                      
                        <asp:Panel ID="pnlSearch" runat="server" DefaultButton="btnSearch">
                            <table cellpadding="3" cellspacing="1">
                                <tr>
                                <td>Patient Name / ID:  </td>
                                <td><asp:TextBox ID="txtPatientName" runat="server" Width="120px"></asp:TextBox></td>
                                <td>
                                    <telerik:RadButton ID="btnSearch"  Text="Search" runat="server" EnableEmbeddedSkins="False" Skin="Activity">
                                        <Icon PrimaryIconUrl="../App_Themes/Images/Search_16.png"/>
                                    </telerik:RadButton>
                                </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </td>
            </tr>
            <tr>
                    <td align="right">
 
                        <asp:Panel ID="pnlControls" runat="server">
                            <table cellpadding="3" cellspacing="1">
                                <tr>
                                    <td>
                                    <telerik:RadButton ID="btnAddToList"  Text="Add to list" runat="server" EnableEmbeddedSkins="False" Skin="Activity" Visible="false">
                                        <Icon PrimaryIconUrl="../App_Themes/Images/add_16.png"/>
                                    </telerik:RadButton>
                                    </td>
  
                                    <td> </td
                 
                                <td>
                                    <telerik:RadButton ID="btnRefresh"  Text="Refresh" runat="server" EnableEmbeddedSkins="False" Skin="Activity">
                                        <Icon PrimaryIconUrl="../App_Themes/Images/Refresh_16.png"/>
                                    </telerik:RadButton>
                                </td>
                                </tr>
                            </table>
                        </asp:Panel>
                                         
                    </td>
            </tr>
        </table>    
    </div>
      
    <asp:timer ID="tmrGridRefresh" runat="server"  Interval="45000" Enabled="true"/>
 
    <telerik:RadGrid
    ID="rdDashboard"
    runat="server"
    AutoGenerateColumns="False"
    EnableEmbeddedSkins="False"
    Skin="Activity"
    GridLines="None"
    EnableViewState="true"
    GroupingSettings-CaseSensitive="false"
      
    >
        <MasterTableView DataKeyNames="ID">
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" UniqueName="ID" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="AppointmentEdit" UniqueName="AppointmentEdit"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="ViewDemog"  UniqueName="ViewDemog"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="IsVulnerable" UniqueName="IsVulnerable"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="VisuallyImpaired"  UniqueName="VisuallyImpaired"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Transport" UniqueName="Transport"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Porter" UniqueName="Porter"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Interpreter"  UniqueName="Interpreter"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="ReceptionAlert"  UniqueName="ReceptionAlert"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="AdditionalEvent" ImageUrl="~/App_Themes/Images/Scales_24.png" UniqueName="AdditionalEvent" SortExpression="AdditionalEvent" HeaderText=" … "  HeaderStyle-HorizontalAlign="Center"  ItemStyle-HorizontalAlign="Center"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Activity"  UniqueName="Activity" ><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
 
                    <telerik:GridTemplateColumn HeaderText="Patient Name" SortExpression="sname" UniqueName="PatientName" AllowFiltering="true" DataField="sname">
                        <ItemTemplate>
                            <asp:Label ID="lblPatientName" runat="server" ></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                     
                    <telerik:GridTemplateColumn HeaderText="" UniqueName="Controls" AllowFiltering="false"><HeaderStyle Width="1px" />
                        <ItemTemplate>
                                <asp:ImageButton ID="imbAssign" runat="server" ImageUrl="~/App_Themes/Images/Assign_24.png" AlternateText="Send to Activity"  Visible="false"/>
                                <asp:Literal ID="ltlActivity" runat="server"></asp:Literal>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
 
                    <telerik:GridBoundColumn DataField="Patient_ID" HeaderText="Patient ID" SortExpression="Patient_ID" UniqueName="Patient_ID"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Clinic" HeaderText="Clinic" SortExpression="Clinic" UniqueName="Clinic" AllowFiltering="true"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CurrentLocation" HeaderText="Location" SortExpression="CurrentLocation" UniqueName="CurrentLocation" AllowFiltering="true"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Specialty" HeaderText="Specialty" SortExpression="Specialty" UniqueName="Specialty" AllowFiltering="true"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Consultant" SortExpression="Consultant" UniqueName="Consultant" AllowFiltering="true"></telerik:GridBoundColumn>
 
 
                    <telerik:GridTemplateColumn HeaderText="Time" SortExpression="AppTime"  AllowFiltering="false" DataField="AppTime">
                        <ItemTemplate>
                            <asp:Label ID="lblApptime" runat="server" Text='<%# DirectCast(Container.DataItem, System.Data.DataRowView)("AppTime")%>'></asp:Label>
                            <asp:Label ID="lblvisit_Type" runat="server" Text='<%# DirectCast(Container.DataItem, System.Data.DataRowView)("visit_Type")%>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                     
                    <telerik:GridTemplateColumn HeaderText="Main Arrival" SortExpression="TimeArrival" HeaderStyle-HorizontalAlign="Center"  ItemStyle-HorizontalAlign="Center" AllowFiltering="false" UniqueName="MainArrival">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkTimeArrival" runat="server" AutoPostBack="True"/>
                            <asp:Label ID="lblTimeArrival" runat="server" Text='<%# DirectCast(Container.DataItem, System.Data.DataRowView)("TimeArrival")%>'></asp:Label
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                     
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="AttendStatus" UniqueName="AttendStatus" Visible="true" SortExpression="AttendStatusClinic" HeaderText=" … " HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Call" ImageUrl="~/App_Themes/Images/Call_24.png" UniqueName="Call" Visible="true"><HeaderStyle Width="1px" /><ItemStyle Width="1px" /></telerik:GridButtonColumn>
                    <telerik:GridBoundColumn DataField="CurrentLocationEvent_ID" HeaderText="CurrentLocationEvent_ID" UniqueName="CurrentLocationEvent_ID" Display="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Call2LocationEvent_ID" HeaderText="Call2LocationEvent_ID" UniqueName="Call2LocationEvent_ID" Display="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Return2LocationEvent_ID" HeaderText="Return2LocationEvent_ID" UniqueName="Return2LocationEvent_ID" Display="false"></telerik:GridBoundColumn>
                     
                    <telerik:GridTemplateColumn HeaderText="Arrival" SortExpression="LocationArrival" HeaderStyle-HorizontalAlign="Center"  ItemStyle-HorizontalAlign="Center" AllowFiltering="false" UniqueName="LocationArrival">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkLocationArrival" runat="server" AutoPostBack="True" visible="false" OnCheckedChanged="chkLocationArrival_CheckedChanged"/>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                     
                    <telerik:GridTemplateColumn HeaderText="Notes" SortExpression="NotesTime"  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false"  UniqueName="Notes" >
                        <ItemTemplate>
                            <asp:CheckBox ID="chkNotes" runat="server" AutoPostBack="True"  OnCheckedChanged="chkNotes_CheckedChanged"/>
                            <asp:Label ID="lblNoteTime" runat="server" Text='<%# DirectCast(Container.DataItem, System.Data.DataRowView)("NotesTime")%>'></asp:Label>           
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
 
                    <telerik:GridTemplateColumn HeaderText="Ready<br/>Clinician" SortExpression="ReadyConsultantTime"  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false"  UniqueName="ReadyConsultant" >
                        <ItemTemplate>
                            <asp:CheckBox ID="chkReadyConsultant" runat="server" AutoPostBack="True"  OnCheckedChanged="chkReadyConsultant_CheckedChanged"/>
                            <asp:Label ID="lblReadyConsultantTime" runat="server" Text='<%# DirectCast(Container.DataItem, System.Data.DataRowView)("ReadyConsultantTime")%>'></asp:Label>           
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>  
    
                    <telerik:GridTemplateColumn HeaderText="Seen<br/>Clinician" SortExpression="SeenConsultantTime"  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false"  UniqueName="SeenConsultant" >
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSeenConsultant" runat="server" AutoPostBack="True"  OnCheckedChanged="chkSeenConsultant_CheckedChanged"/>
                            <asp:Label ID="lblSeenConsultantTime" runat="server" Text='<%# DirectCast(Container.DataItem, System.Data.DataRowView)("SeenConsultantTime")%>'></asp:Label>           
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
 
                    <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center"  ItemStyle-HorizontalAlign="Center" AllowFiltering="false" UniqueName="Arrival">
                        <ItemTemplate>
                               <asp:CheckBox ID="chkComplete" runat="server" AutoPostBack="True" Visible="false" OnCheckedChanged="chkComplete_CheckedChanged"/>
                               <asp:ImageButton  ID="btnAction" runat="server" ImageUrl="~/App_Themes/Images/Actions_24.png" AlternateText="Actions"  />
                               <asp:ImageButton  ID="btnOutcome" runat="server" />
 
                        </ItemTemplate>
                        <ItemStyle Width="60px" />
                    </telerik:GridTemplateColumn>
                
                </Columns>
     
             
    </MasterTableView>
 
    <FilterMenu EnableEmbeddedSkins="False"></FilterMenu>
 
    </telerik:RadGrid>
 
       
</form>
 
 
</body>
</html>
       


In the code behind, I have a scetion that loads either location selector


If UseMyLocations = False Then
 
               pnlLocation.Visible = True
               pnlMyLocation.Visible = False
 
               'Location
               Dim l As New CoreData
               Dim l_dt As DataTable = l.LocationTreeLimited(User_GUID)
 
               If l_dt.Rows.Count > 0 Then
                   Dim rtvLocation As RadTreeView = CType(Page.FindControl("ddlLocation$i0$rtvLocation"), RadTreeView)
                   With rtvLocation
                       .DataValueField = 1
                       .DataSource = l_dt
                       .DataFieldID = "Location_ID"
                       .DataFieldParentID = "ParentLocation_ID"
                       .DataTextField = "Location"
                       .DataValueField = "Location_ID"
                       .DataBind()
                       .ExpandAllNodes()
                   End With
               End If
 
               If (Local_Location_ID = 0 And Len(Local_Location) = 0) Then
                   Dim dl As New CoreData
                   Dim dl_ds As Data.DataSet = dl.DefaultGridParameters(User_GUID)
                   If dl_ds.Tables(0).Rows.Count > 0 Then
                       DefaultLocation = dl_ds.Tables(0).Rows(0)("DefaultLocation_ID")
                       ddlLocation.Items(0).Attributes("nodeValue") = dl_ds.Tables(0).Rows(0)("DefaultLocation_ID")
                       ddlLocation.Items(0).Value = dl_ds.Tables(0).Rows(0)("DefaultLocation_ID")
                       ddlLocation.Items(0).Text = dl_ds.Tables(0).Rows(0)("Location")
 
                       SpecialtyByLocation(dl_ds.Tables(0).Rows(0)("DefaultLocation_ID"))
                       ClinicByLocation(dl_ds.Tables(0).Rows(0)("DefaultLocation_ID"))
                   End If
               Else
                   DefaultLocation = Local_Location_ID
                   ddlLocation.Items(0).Attributes("nodeValue") = Local_Location_ID
                   ddlLocation.Items(0).Value = Local_Location_ID
                   ddlLocation.Items(0).Text = Local_Location
 
                   SpecialtyByLocation(Local_Location_ID)
                   ClinicByLocation(Local_Location_ID)
               End If
 
           Else
 
               pnlLocation.Visible = False
               pnlMyLocation.Visible = True
 
               Dim ml As New CoreData
               Dim ml_dt As DataTable = ml.MyLocationsByID(Profile.SiteOptions.MyLocationsList, User_GUID)
 
               If ml_dt.Rows.Count > 0 Then
                   With ddlMyLocation
                       .Items.Clear()
                       .Items.Insert(0, New RadComboBoxItem("", 0))
                       .DataSource = ml_dt
                       .DataTextField = "Location"
                       .DataValueField = "Location_ID"
                       .DataBind()
                   End With
               End If
 
               If Local_Location_ID = 0 Then
                   Dim dl As New CoreData
                   Dim dl_ds As Data.DataSet = dl.DefaultGridParameters(User_GUID)
                   If dl_ds.Tables(0).Rows.Count > 0 Then
                       DefaultLocation = dl_ds.Tables(0).Rows(0)("DefaultLocation_ID")
                       ddlMyLocation.SelectedValue = dl_ds.Tables(0).Rows(0)("DefaultLocation_ID")
                       SpecialtyByLocation(dl_ds.Tables(0).Rows(0)("DefaultLocation_ID"))
                       ClinicByLocation(dl_ds.Tables(0).Rows(0)("DefaultLocation_ID"))
                   End If
               Else
                   DefaultLocation = Local_Location_ID
                   ddlMyLocation.SelectedValue = Local_Location_ID
                   SpecialtyByLocation(Local_Location_ID)
                   ClinicByLocation(Local_Location_ID)
               End If
 
           End If


I have an AJAX section:
Protected Sub AjaxManager_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles AjaxManager.AjaxRequest
 
    If e.Argument = "Rebind" Then
        Try
            rdDashboard.Rebind()
        Catch ex As Exception
            WriteError("AjaxManager_AjaxRequest / Rebind", ex.Message)
        End Try
    End If
 
    If e.Argument = "LocationChange" Then
 
        Dim Location_ID As Int32
        If UseMyLocations = False Then
            Location_ID = CInt(ddlLocation.Items(0).Attributes("nodeValue"))
        Else
            Location_ID = ddlMyLocation.SelectedValue
        End If
 
        SpecialtyByLocation(Location_ID)
        ClinicByLocation(Location_ID)
        SetSelections()
 
        Try
            rdDashboard.Rebind()
        Catch ex As Exception
            WriteError("AjaxManager_AjaxRequest / LocationChange", ex.Message)
        End Try
    End If
 
    If e.Argument = "RebindSpecialty" Then
        Try
            rdDashboard.Rebind()
        Catch ex As Exception
            WriteError("AjaxManager_AjaxRequest / Rebind", ex.Message)
        End Try
    End If
 
 
End Sub


I Hope you can do something with this.

Andy


0
Andy Green
Top achievements
Rank 2
answered on 09 Jul 2014, 10:40 AM
HI

There is an error in my code behind code above. The

pnlLocation.Visible = True               
pnlMyLocation.Visible = False

Should in fact be:
ddlLocation.Visible = True               
ddlMyLocation.Visible = False

But neither option works!

Andy

0
Maria Ilieva
Telerik team
answered on 10 Jul 2014, 11:14 AM
Hello Andy,

I revised the provided full markup and  the RadAjaxManager settings looks correct to me.
However as the page contains a lot of various controls it is bit difficult to isolate what exactly could cause the problem.

Could you please elaborate a bit more on what you exactly mean by "the Ajax breaks? I suppose that some js error could appear on Ajax request that might cause the request to fail.

Please verify if any js errors appear and elaborate a bit more on what exactly is the Ajax issue you are currently facing.


Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Andy Green
Top achievements
Rank 2
answered on 10 Jul 2014, 11:52 AM
Hi

If I hide one of the controls (pnlLocation or pnlMylocation and before that ddlLocation and dllMyLocation) pn postback the ajax'd contol do not render, they disappear.

If I do not hide either contol it works, but the additional control is now visible on the page.

I'm hiding the contol with Visible=false which removes it from markup, If I corespondingly remove the AJAX sections (trigger controls) again the page works, but there is no ajax on the *location controls

I have this working by replacing:

 'pnlLocation.Visible = false
  'pnlMyLocation.Visible = True

With

                pnlLocation.Attributes.Add("style", "display: none")
                pnlMyLocation.Attributes.Add("style", "display: block")

But doing it this way both control are still in the markup.


Andy
0
Andy Green
Top achievements
Rank 2
answered on 10 Jul 2014, 03:36 PM
Hi Maria

I'd consider this closed. I have remove the panels and gone with changing the visibility with javascript.

​               pnlLocation.Attributes.Add("style", "display: none")
                pnlMyLocation.Attributes.Add("style", "display: block")


Seems to work quite well.


Andy
0
Maria Ilieva
Telerik team
answered on 11 Jul 2014, 08:08 AM
Hi Andy,

In case manipulating the buttons visibility on the client works for you, you could continue using this approach.
However if you need further assistance in future for this case and you need to switch back to the original scenario it will be best to send us your isolated application so that we could investigate the problem in deep as it appears to be related to your logic and provide the best solution.

Thank you for your great cooperation.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Ajax
Asked by
Andy Green
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Andy Green
Top achievements
Rank 2
Share this question
or