Rad Controls Disabled in Ajax Panel

2 posts, 1 answers
  1. Cliff Gibson
    Cliff Gibson avatar
    45 posts
    Member since:
    Oct 2009

    Posted 08 Jul 2010 Link to this post

    I've got an Ajax Panel on a page which contains some standard asp controls (text boxes, check boxes etc) and also a Rad Combo, Rad Rating and Rad Editor.

    When a record is selected in the search results Rad Grid the items within the panel are updated and the panal refreshed using the Ajax Manager Proxy (within Masterpage).

    However the 3 Rad controls are not selectable, the Rating is populating with the correct value but it cannot be selected, not can the combo box or the editor but all the other standard asp controls are fine...

    The control of the Ajax Panel is AjaxPanelMain and the Rating is RadRatingHotel...

    ASPX Code:
    <%@ Page Language="C#" 
             MasterPageFile="~/MasterPage.master" 
             AutoEventWireup="true" 
             CodeFile="Venues.aspx.cs" 
             Inherits="Forms_Venues" %>
               
    <%@ Register Assembly="Telerik.Web.UI" 
                 Namespace="Telerik.Web.UI" 
                 TagPrefix="telerik" %>
                   
    <%@ MasterType VirtualPath="~/MasterPage.master" %>
      
      
    <asp:Content ID="Content1" ContentPlaceHolderID="contentHead" Runat="Server">
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function openRadWinCreateVenue() {
                    radopen("../Dialogs/CreateVenue.aspx", "RadWindowCreateVenue");
                }
      
                function openRadWinCreateTask() {
                    var txtVenueName = document.getElementById('<%= txtVenueName.ClientID %>');
      
                    if (txtVenueName != null) {
                        radopen("../Dialogs/CreateTask.aspx?ACTION=TASK_FROM_VENUE&AGENDA_LINE_TITLE=" + txtVenueName.value, "RadWindowCreateTask");
                    }
                }
      
                function openRadWinCreateVenueContact() {
                    var lblVenueID = document.getElementById('<%= lblVenueID.ClientID %>');
      
                    if (lblVenueID != null) {
                        radopen("../Dialogs/VenueContact.aspx?ACTION=ADD", "RadWindowVenueContact");
                    }
                }
                function openRadWinUpdateVenueContact(ContactID) {                
                    radopen("../Dialogs/VenueContact.aspx?ACTION=UPDATE&contactID=" + ContactID, "RadWindowVenueContact");
                }
      
                function openRadWinPhotoAlbum() {
                    var lblVenueID = document.getElementById('<%= lblVenueID.ClientID %>');
                    radopen("../Dialogs/PhotoAlbum.aspx?FROM=VENUE_MAINTENANCE&venueID=" + lblVenueID, "RadWindowPhotoAlbum");
                }
      
                function openRadWinCreateVenueRoom() {
                    var label = document.getElementById('<%= lblVenueID.ClientID %>');
      
                    if (label != null) {
                        radopen("../Dialogs/VenueRoom.aspx?ACTION=ADD", "RadWindowVenueRoom");
                    }
                }
                function openRadWinUpdateVenueRoom(RoomID) {
                    radopen("../Dialogs/VenueRoom.aspx?ACTION=UPDATE&roomID=" + RoomID, "RadWindowVenueRoom");
                }
                  
      
            </script>
        </telerik:RadCodeBlock>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="contentBody" Runat="Server">
          
        <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnSearch">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGridVenueSearch" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGridVenueSearch">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="AjaxPanelMain" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridVenueContacts" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridVenueRooms" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
          
        <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="960" Height="550">
            <telerik:RadPane ID="LeftPane" runat="server" Width="22px" Scrolling="none">
                <telerik:RadSlidingZone ID="SlidingZoneSearch" runat="server" Width="22px" 
                    DockedPaneId="RadSlidingPaneSearch">
                    <telerik:RadSlidingPane ID="RadSlidingPaneSearch" Title="Search" runat="server" 
                        Width="250px" Scrolling="None" 
                                            IconURL="~/Images/Search.png" DockOnOpen="True">
                        <table border="0" cellpadding="1" cellspacing="1" width="100%">
                            <tr>
                                <td>
                                    <asp:Label ID="lblSearchCountryHeader" runat="server" Text="Country"></asp:Label>
                                </td>
                                <td>
                                    <telerik:RadComboBox ID="cboCountriesSearch" Runat="server" Width="160px"></telerik:RadComboBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="lblSearchVenueNameHeader" runat="server" Text="Venue"></asp:Label>
                                </td>
                                <td>
                                    <telerik:RadTextBox ID="txtSearchVenueName" runat="server" Width="160px">
                                    </telerik:RadTextBox>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <asp:Button ID="btnSearch" runat="server" Text="Search"
                                        onclick="btnSearch_Click" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <telerik:RadGrid
                                        ID="RadGridVenueSearch" runat="server" AutoGenerateColumns="False" GridLines="None" 
                                        onneeddatasource="RadGridVenueSearch_NeedDataSource" Width="240px" Visible="False" 
                                        onselectedindexchanged="RadGridVenueSearch_SelectedIndexChanged" ShowHeader="false">
                                        <ClientSettings>
                                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                                        </ClientSettings>
                                        <MasterTableView DataKeyNames="VenueID">
                                        <RowIndicatorColumn>
                                        <HeaderStyle Width="20px"></HeaderStyle>
                                        </RowIndicatorColumn>
                                        <ExpandCollapseColumn>
                                        <HeaderStyle Width="20px"></HeaderStyle>
                                        </ExpandCollapseColumn>
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="VenueID" Visible="False" />
                                                  
                                                <telerik:GridTemplateColumn HeaderText="Event Hotels">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="lbtnVenueName" runat="server" Text='<%# Eval("VenueName") %>' CommandName="Select"></asp:LinkButton>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                            </Columns>
                                        </MasterTableView>
                                    </telerik:RadGrid>
                                </td>
                            </tr>
                        </table>
                          
                          
                    </telerik:RadSlidingPane>
                </telerik:RadSlidingZone>
            </telerik:RadPane>
              
              
              
            <telerik:RadSplitBar ID="Radsplitbar1" runat="server" EnableResize="False" Width="5px"></telerik:RadSplitBar>
              
              
              
            <telerik:RadPane ID="MainPane" runat="server" Scrolling="None" Width="933px">
                  
                  
                <telerik:RadDockLayout ID="RadDockLayoutVenues" runat="server">
                    <table width="100%">
                        <tr>
                            <td colspan="2">
                                <telerik:RadDockZone ID="RadDockZoneTop" runat="server" BorderStyle="None">
                                    <telerik:RadDock ID="RadDockVenueHeader" runat="server" Title="Venue Information" EnableDrag="false"
                                                     EnableRoundedCorners="True" oncommand="RadDockVenueHeader_Command">
                                        <Commands>
                                            <telerik:DockExpandCollapseCommand />
                                            <telerik:DockCommand AutoPostBack="false" Name="Add Venue" CssClass="DockAdd" Text="Add New Venue..." OnClientCommand="openRadWinCreateVenue" />
                                            <telerik:DockCommand AutoPostBack="True" Name="Save Venue" CssClass="DockSave" Text="Save selected Venue information" />
                                            <telerik:DockCommand AutoPostBack="false" Name="Create Task" CssClass="DockTask" Text="Create Task based on the selected Venue..." OnClientCommand="openRadWinCreateTask" />
                                        </Commands>
                                        <ContentTemplate>
                                            <telerik:RadAjaxPanel ID="AjaxPanelMain" runat="server" Width="100%" Visible="false">
                                                <table border="0" cellpadding="1" cellspacing="1" width="100%">
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblVenueNameHeader" runat="server" Text="Venue:"></asp:Label
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtVenueName" runat="server" Width="300px" MaxLength="50"></telerik:RadTextBox>
                                                            <asp:Label ID="lblVenueID" runat="server" Text="" Style="display:none"></asp:Label>
                                                        </td>
                                                        <td align="center" rowspan="6" valign="middle">
                                                            <telerik:RadBinaryImage ID="imgVenue" runat="server" ImageAlign="Middle"/>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblAddress1Header" runat="server" Text="Address 1:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtAddress1" runat="server" Width="300px" MaxLength="50">
                                                            </telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblAddress2Header" runat="server" Text="Address 2:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtAddress2" runat="server" Width="300px" MaxLength="50">
                                                            </telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblCityHeader" runat="server" Text="City:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtCity" runat="server" Width="300px" MaxLength="50">
                                                            </telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblPostCodeHeader" runat="server" Text="Post Code:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtPostCode" runat="server" Width="100px" MaxLength="50">
                                                            </telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblCountryHeader" runat="server" Text="Country:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadComboBox ID="cboCountry" Runat="server" Width="160px"></telerik:RadComboBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblPhone" runat="server" Text="Phone:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtPhone" runat="server" Width="160px" MaxLength="50"></telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblFax" runat="server" Text="Fax:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtFax" runat="server" Width="160px" MaxLength="50"></telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblURL" runat="server" Text="URL:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtURL" runat="server" Width="300px"  MaxLength="100"></telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblURLMap" runat="server" Text="Map URL:" ToolTip="e.g. URL from Google Maps"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadTextBox ID="txtURLMap" runat="server" Width="300px" ToolTip="e.g. URL from Google Maps"></telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblHotel" runat="server" Text="Hotel:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <asp:CheckBox ID="chkHotel" runat="server" Text="" TextAlign="Right"/>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblRating" runat="server" Text="Hotel Rating:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadRating ID="RadRatingHotel" runat="server" SelectionMode="Single">
                                                            </telerik:RadRating>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblNotes" runat="server" Text="Notes:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <telerik:RadEditor ID="RadEditorNotes" runat="server" EditModes="Design" 
                                                                        Width="300px" ToolbarMode="ShowOnFocus" Height="100px"
                                                                        ToolsFile="~/Forms/EditorToolBar/CustomTools.xml">
                                                            </telerik:RadEditor>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblObsolete" runat="server" Text="Obsolete:"></asp:Label>   
                                                        </td>
                                                        <td>
                                                            <asp:CheckBox ID="chkObsolete" runat="server" Text="" TextAlign="Right"/>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </telerik:RadAjaxPanel>
                                        </ContentTemplate>
                                    </telerik:RadDock>
                                </telerik:RadDockZone>
                            </td>
                        </tr>
                        <tr>
                            <td width="70%" valign="top">
                                <telerik:RadDockZone ID="RadDockZoneBottomLeft" runat="server" BorderStyle="None">
                                    <telerik:RadDock ID="RadDockVenueContacts" runat="server" Title="Venue Contacts" 
                                                     EnableRoundedCorners="True" EnableDrag="false">
                                        <Commands>
                                            <telerik:DockExpandCollapseCommand />
                                            <telerik:DockCommand AutoPostBack="false" Name="Add Contact" CssClass="DockAdd" Text="Add Contact for selected Venue..." OnClientCommand="openRadWinCreateVenueContact" />
                                        </Commands>
                                        <ContentTemplate>
                                            <telerik:RadGrid  ID="RadGridVenueContacts" runat="server" ShowHeader="False" AutoGenerateColumns="False" 
                                                              GridLines="None" onneeddatasource="RadGrids_NeedDataSource"
                                                              onselectedindexchanged="RadGridVenueContacts_SelectedIndexChanged">
                                                <MasterTableView DataKeyNames="ContactID" NoMasterRecordsText="No contacts exist">
                                                <RowIndicatorColumn>
                                                <HeaderStyle Width="20px"></HeaderStyle>
                                                </RowIndicatorColumn>
                                                <ExpandCollapseColumn>
                                                <HeaderStyle Width="20px"></HeaderStyle>
                                                </ExpandCollapseColumn>
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="VenueID" Visible="False" />
                                                        <telerik:GridBoundColumn DataField="ContactID" Visible="False" />
      
                                                        <telerik:GridTemplateColumn HeaderStyle-Width="0px" ItemStyle-Width="0px" ItemStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <asp:Image ID="imgObsolete" runat="server" ImageUrl="~/Images/Recycle.png" Visible='<%# Convert.ToBoolean(Eval("Obsolete") == DBNull.Value ? "False" : Eval("Obsolete")) %>' ToolTip="This item is obsolete" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                  
                                                        <telerik:GridTemplateColumn>
                                                            <ItemTemplate>
                                                                <asp:LinkButton ID="lbtnFullName" runat="server" Text='<%# Eval("FullName") %>' CommandName="Select" ToolTip="Click to open contact"></asp:LinkButton>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
      
                                                        <telerik:GridBoundColumn DataField="JobTitle"/>
                                                        <telerik:GridBoundColumn DataField="DirectLine"/>
                                                    </Columns>
                                                </MasterTableView>
                                            </telerik:RadGrid>
                                        </ContentTemplate>
                                    </telerik:RadDock>
                                </telerik:RadDockZone>
                            </td>
                            <td width="30%" valign="top">
                                <telerik:RadDockZone ID="RadDockZoneBottomRight" runat="server" BorderStyle="None">
                                    <telerik:RadDock ID="RadDockVenueRooms" runat="server" Title="Venue Rooms" EnableRoundedCorners="True" EnableDrag="false">
                                        <Commands>
                                            <telerik:DockExpandCollapseCommand />
                                            <telerik:DockCommand AutoPostBack="false" Name="Add Room" CssClass="DockAdd" Text="Add Room for selected Venue..." OnClientCommand="openRadWinCreateVenueRoom" />
                                        </Commands>
                                        <ContentTemplate>
                                            <telerik:RadGrid  ID="RadGridVenueRooms" runat="server" ShowHeader="False" AutoGenerateColumns="False" 
                                                             GridLines="None" onneeddatasource="RadGrids_NeedDataSource"
                                                              onselectedindexchanged="RadGridVenueRooms_SelectedIndexChanged" >
                                                <MasterTableView DataKeyNames="RoomID" NoMasterRecordsText="No rooms exist">
                                                <RowIndicatorColumn>
                                                <HeaderStyle Width="20px"></HeaderStyle>
                                                </RowIndicatorColumn>
                                                <ExpandCollapseColumn>
                                                <HeaderStyle Width="20px"></HeaderStyle>
                                                </ExpandCollapseColumn>
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="VenueID" Visible="False" />
                                                        <telerik:GridBoundColumn DataField="RoomID" Visible="False" />
      
                                                        <telerik:GridTemplateColumn HeaderStyle-Width="0px" ItemStyle-Width="0px" ItemStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <asp:Image ID="imgObsolete" runat="server" ImageUrl="~/Images/Recycle.png" Visible='<%# Convert.ToBoolean(Eval("Obsolete") == DBNull.Value ? "False" : Eval("Obsolete")) %>' ToolTip="This item is obsolete" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                  
                                                        <telerik:GridTemplateColumn>
                                                            <ItemTemplate>
                                                                <asp:LinkButton ID="lbtnRoomName" runat="server" Text='<%# Eval("Name") %>' CommandName="Select"></asp:LinkButton>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
      
                                                        <telerik:GridBoundColumn DataField="Capacity"/>
                                                    </Columns>
                                                </MasterTableView>
                                            </telerik:RadGrid>
                                        </ContentTemplate>
                                    </telerik:RadDock>
                                </telerik:RadDockZone>
                            </td>
                        </tr>
                    </table>
                </telerik:RadDockLayout>
                  
            </telerik:RadPane>
      
        </telerik:RadSplitter>
          
        <telerik:RadWindowManager ID="RadWindowManager" runat="server" 
            Behaviosr="Default" InitialBehaviors="None" EnableViewState="False">
            <Windows>
                <telerik:RadWindow runat="server"  ID="RadWindowCreateVenue" InitialBehaviors="None" 
                    NavigateUrl="~/Dialogs/CreateVenue.aspx" ReloadOnShow="true" Animation="FlyIn"
                    Height="325px" Modal="True" Title="Create Venue" Width="430px" AnimationDuration="500" 
                    Behaviors="Close, Move" Enabled="True" VisibleStatusbar="False" IconUrl="~/favicon.ico">
                </telerik:RadWindow>
      
                <telerik:RadWindow runat="server"  ID="RadWindowCreateTask" InitialBehaviors="None" 
                    NavigateUrl="~/Dialogs/CreateTask.aspx" ReloadOnShow="true" Animation="FlyIn"
                    Height="400px" Modal="true" Title="Create Task" Width="420px" AnimationDuration="500" 
                    Behaviors="Close, Move" Enabled="True" VisibleStatusbar="False" IconUrl="~/favicon.ico" 
                    ShowContentDuringLoad="False">
                </telerik:RadWindow>
      
                <telerik:RadWindow runat="server"  ID="RadWindowVenueContact" InitialBehaviors="None" 
                    NavigateUrl="~/Dialogs/VenueContact.aspx" ReloadOnShow="true" Animation="FlyIn"
                    Height="650px" Modal="true" Title="Venue Contact" Width="500px" AnimationDuration="500" 
                    Behaviors="Close, Move" Enabled="True" VisibleStatusbar="False" IconUrl="~/favicon.ico" 
                    ShowContentDuringLoad="False">
                </telerik:RadWindow>
      
                <telerik:RadWindow runat="server"  ID="RadWindowVenueRoom" InitialBehaviors="None" 
                    NavigateUrl="~/Dialogs/VenueRoom.aspx" ReloadOnShow="true" Animation="FlyIn"
                    Height="600px" Modal="true" Title="Venue Room" Width="500px" AnimationDuration="500" 
                    Behaviors="Close, Move" Enabled="True" VisibleStatusbar="False" IconUrl="~/favicon.ico" 
                    ShowContentDuringLoad="False">
                </telerik:RadWindow>
      
                <telerik:RadWindow runat="server"  ID="RadWindowPhotoAlbum" InitialBehaviors="None" 
                    NavigateUrl="~/Dialogs/PhotoAlbum.aspx" ReloadOnShow="true" Animation="FlyIn"
                    Height="600px" Modal="true" Title="Photo Album" Width="600px" AnimationDuration="600" 
                    Behaviors="Close, Move" Enabled="True" VisibleStatusbar="False" IconUrl="~/favicon.ico" 
                    ShowContentDuringLoad="False">
                </telerik:RadWindow>
      
            </Windows>
        </telerik:RadWindowManager>
      
      
    </asp:Content>


    Code Behind:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Data.SqlClient;
    using Telerik.Web.UI;
      
    public partial class Forms_Venues : System.Web.UI.Page
    {
        #region Events
      
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (Session["ACTION"] != null)
                    {
                        int VenueID;
      
                        switch (Session["ACTION"].ToString())
                        {
                                  
                            case "VENUE ADDED":
                                VenueID = Convert.ToInt32(Session["VENUE_ID"].ToString());
                                LoadVenue(VenueID);
                                break;
                            case "VENUE CONTACT SAVED":
                                VenueID = Convert.ToInt32(Session["VENUE_ID"].ToString());
                                LoadVenue(VenueID);
                                break;
                            case "VENUE ROOM SAVED":
                                VenueID = Convert.ToInt32(Session["VENUE_ID"].ToString());
                                LoadVenue(VenueID);
                                break;
                            case "TASK ADDED":
                                VenueID = Convert.ToInt32(Session["VENUE_ID"].ToString());
                                LoadVenue(VenueID);
                                break;
                            default:
                                break;
                        }
                        Session.Remove("ACTION");
                    }
                    LoadCountriesSearchCombo();
                }
            }
            catch (Exception ex)
            {
                Master.ShowMsgBoxPopup("Error Loading Page", Napp_ErrorTrapping.BuildExeceptionMessage(ex));
            }
        }
          
        protected void RadGridVenueSearch_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                GridDataItem dataItem = (GridDataItem)RadGridVenueSearch.SelectedItems[0];
                int VenueID = Convert.ToInt32(dataItem["VenueID"].Text);
      
                Session.Add("ACTION", "VENUE SELECTED");
                Session.Add("VENUE_ID", VenueID);
                lblVenueID.Text = VenueID.ToString();
                LoadVenue(VenueID);
            }
            catch (Exception ex)
            {
                Master.ShowMsgBoxPopup("An Error Occurred", Napp_ErrorTrapping.BuildExeceptionMessage(ex));
            }
        }
      
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                RadGridVenueSearch.Visible = true;
                RadGridVenueSearch.Rebind();
            }
            catch (Exception ex)
            {
                Master.ShowMsgBoxPopup("An Error Occurred", Napp_ErrorTrapping.BuildExeceptionMessage(ex));
            }
        }
      
        protected void RadGridVenueSearch_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            try
            {
                DataTable dt = EM_Data.SearchVenues(cboCountriesSearch.SelectedValue, txtSearchVenueName.Text);
                RadGridVenueSearch.DataSource = dt.DefaultView;
            }
            catch (Exception ex)
            {
                Master.ShowMsgBoxPopup("An Error Occurred", Napp_ErrorTrapping.BuildExeceptionMessage(ex));
            }
        }
      
        protected void RadGrids_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            if (lblVenueID.Text != "")
            {
                DataTable dt = null;
      
                RadGrid grid = (RadGrid)source;
      
                switch (grid.ID)
                {
                    case "RadGridVenueContacts":
                        dt = EM_Data.ReturnVenueContacts(int.Parse(lblVenueID.Text));
                        break;
                    case "RadGridVenueRooms":
                        dt = EM_Data.ReturnVenueRooms(int.Parse(lblVenueID.Text));
                        break;
                    default:
                        break;
                }
      
                grid.DataSource = dt.DefaultView;
            }
      
        }
      
        protected void RadGridVenueContacts_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                GridDataItem dataItem = (GridDataItem)RadGridVenueContacts.SelectedItems[0];
                string ContactID = dataItem["ContactID"].Text;
      
                RadWindowVenueContact.Title = "Update Contact for Venue " + txtVenueName.Text;
                string strScript = "openRadWinUpdateVenueContact(" + ContactID.ToString() + ");";
                RadScriptManager.RegisterStartupScript(this, this.GetType(), "openRadWinUpdateVenueContact", strScript, true);
            }
            catch (Exception ex)
            {
                Master.ShowMsgBoxPopup("An Error Occurred", Napp_ErrorTrapping.BuildExeceptionMessage(ex));
            }
        }
      
        protected void RadGridVenueRooms_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                GridDataItem dataItem = (GridDataItem)RadGridVenueRooms.SelectedItems[0];
                string RoomID = dataItem["RoomID"].Text;
      
                RadWindowVenueContact.Title = "Update Room for Venue " + txtVenueName.Text;
                string strScript = "openRadWinUpdateVenueRoom(" + RoomID.ToString() + ");";
                RadScriptManager.RegisterStartupScript(this, this.GetType(), "openRadWinUpdateVenueRoom", strScript, true);
            }
            catch (Exception ex)
            {
                Master.ShowMsgBoxPopup("An Error Occurred", Napp_ErrorTrapping.BuildExeceptionMessage(ex));
            }
        }
      
        protected void RadDockVenueHeader_Command(object sender, DockCommandEventArgs e)
        {
            try
            {
                switch (e.Command.Name)
                {
                    case "Save Venue":
                        if (lblVenueID.Text != "")
                        {
                            string result = ControlsAreValid();
      
                            if (result == "Success")
                            {
                                EM_Data.SaveVenue(int.Parse(lblVenueID.Text),
                                                    txtVenueName.Text,
                                                    txtAddress1.Text,
                                                    txtAddress2.Text,
                                                    txtCity.Text,
                                                    cboCountriesSearch.SelectedValue,
                                                    txtPostCode.Text,
                                                    txtURL.Text,
                                                    txtPhone.Text,
                                                    txtFax.Text,
                                                    txtURLMap.Text,
                                                    RadEditorNotes.Content,
                                                    chkHotel.Checked.ToString(),
                                                    int.Parse(RadRatingHotel.Value.ToString()),
                                                    chkObsolete.Checked.ToString());
                            }
                            else
                            {
                                Master.ShowMsgBoxPopup("Cannot Save Venue", result);
                            }
                        }
                        break;
                    case "Create Task":
                        RadWindowCreateTask.Title = "Create Task for Venue " + txtVenueName.Text;
                        string strScript = "openRadWinCreateTask(" + txtVenueName.Text + ");";
                        RadScriptManager.RegisterStartupScript(this, this.GetType(), "openRadWinCreateTask", "openRadWinCreateTask();", true);
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                Master.ShowMsgBoxPopup("An Error Occurred", Napp_ErrorTrapping.BuildExeceptionMessage(ex));
            }
        }
      
        #endregion
          
        #region Methods
      
        private string ControlsAreValid()
        {
            string result = "Success";
      
            if (txtVenueName.Text == "")
                result = "Please enter a 'Name' for this venue.";
      
            return result;
        }
      
        private void LoadVenue(Int32 VenueID)
        {
            DataTable dt = EM_Data.ReturnVenueHeader(VenueID);
            DataRow dr = dt.Rows[0];
      
            lblVenueID.Text = VenueID.ToString();
      
            txtVenueName.Text = dr["VenueName"].ToString();
            txtAddress1.Text = dr["Address1"].ToString();
            txtAddress2.Text = dr["Address2"].ToString();
            txtCity.Text = dr["City"].ToString();
            txtPostCode.Text = dr["PostCode"].ToString();
            txtPhone.Text = dr["MainTelephone"].ToString();
            txtURL.Text = dr["URL"].ToString();
            imgVenue.DataValue = (byte[])(dr["PrimaryPicture"]);
            LoadCountriesVenueCombo(dr["CountryID"].ToString());
            txtFax.Text = dr["Fax"].ToString();
            txtURLMap.Text = dr["GoogleMapsURL"].ToString();
            RadEditorNotes.Content = dr["Notes"].ToString();
            chkHotel.Checked = (dr["IsHotel"].ToString().ToLower() == "true");
      
            if (dr["Rating"].ToString() != "")
                RadRatingHotel.Value = int.Parse(dr["Rating"].ToString());
      
            chkObsolete.Checked = (dr["Obsolete"].ToString().ToLower() == "true");
      
            AjaxPanelMain.Visible = true;
      
            RadGridVenueContacts.Rebind();
            RadGridVenueRooms.Rebind();
      
            DockCommand dc = new DockCommand();
      
            //------------------------------------------------------------------------------
            //This compiles ok, and shows when you look at the commands collection, but the command does not appear.
            //
            //dc.AutoPostBack = false;
            //dc.Name = "Add Contact";
            //dc.CssClass = "DockAdd";
            //dc.Text = "Add Contact";
            //dc.OnClientCommand="openRadWinCreateVenueContact";
      
            //RadDockVenueContacts.Commands.Add(dc);
            //------------------------------------------------------------------------------
        }
      
        private void LoadCountriesSearchCombo()
        {
            cboCountriesSearch.DataValueField = "CountryID";
            cboCountriesSearch.DataTextField = "CountryName";
            cboCountriesSearch.DataSource = EM_Data.ReturnCountries(true);
            cboCountriesSearch.DataBind();
            //cboCombo.SelectedValue = lblHiddenCountryID.Text;
        }
      
        private void LoadCountriesVenueCombo(string CountryID)
        {
            cboCountry.DataValueField = "CountryID";
            cboCountry.DataTextField = "CountryName";
            cboCountry.DataSource = EM_Data.ReturnCountries(true);
            cboCountry.DataBind();
            cboCountry.SelectedValue = CountryID;
            //cboCombo.SelectedValue = lblHiddenCountryID.Text;
        }
      
        #endregion       
    }

  2. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 12 Jul 2010 Link to this post

    Hello Cliff,

    It is not recommended practice to use RadAjaxManager and RadAjaxPanel for ajaxifying the same page content. This often causes conflicts, which lead to unexpected behavior of the ajaxified controls. Try replacing the RadAjaxPanel with an asp Panel and let us know if the issue persists.

    You can check this article for more information.

    Greetings,
    Tsvetina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top