Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
98 views
I'm using the radgrid to display/sort data and maintain consistency in the app, but editing and adding of one particular grid is handled by another control due to complexity. 

I'm able to handle most of this in the OnItemCommand event with either RadGrid.InitInsertCommandName, RadGrid.EditCommandName etc.   The part I'm having trouble with is the actual Add button.  The "Add new item" LinkButton works fine but the "+" button never hits the OnItemCommand event even though they presumably would be doing the exact same thing.  What do I have to do?
Martin
Telerik team
 answered on 12 Jul 2010
1 answer
70 views
The RadComboBox appears to position the results of the ItemRequested event so that the most number of items can appear - for example, if there are 100 results returned, and the bottom of the browser window is closer, the results will appear above the box.

Is there any way to force the results to always appear below the combo box?
Simon
Telerik team
 answered on 12 Jul 2010
1 answer
74 views
I have a databound RadComboBox (with databound item list). If the SelectedValue is not in the item list I get a "Selection out of Range" exception.
Is there any way to prevent this and just set SelectedValue to null?

Thanks!
Simon
Telerik team
 answered on 12 Jul 2010
1 answer
73 views
I'm having an issue binding to an OpenAccessDatasource

I have my DS on the page, and I link it to the combo, all works well, but if I specify a DataText or DataValue field in one of the linked objects it throws an error saying that property doesn't exist (when it does)

So this works
DataTextField="RotationID" DataValueField="RotationID">

This fails
DataTextField="Rotation.RotationName" DataValueField="RotationID">
Simon
Telerik team
 answered on 12 Jul 2010
1 answer
151 views
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       
}

Tsvetina
Telerik team
 answered on 12 Jul 2010
1 answer
84 views
<telerik:RadAjaxManager ID="RadAjaxMgr" runat="server" > 
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
            </telerik:RadAjaxManager> 
        <telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="true" ShowHeader="true" runat="server"    
            Width="97%" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource" OnDetailTableDataBind="RadGrid1_DetailTableDataBind">    
            <MasterTableView Name="Master" DataKeyNames="Id, Parent_id" GridLines="Both" PageSize="15"    
                HierarchyDefaultExpanded="true" HierarchyLoadMode=ServerOnDemand>    
                <SelfHierarchySettings KeyName="id" ParentKeyName="Parent_id" />    
            </MasterTableView>    
        </telerik:RadGrid>  

Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource  
        If Not e.IsFromDetailTable Then  
            RadGrid1.DataSource = GetDataTable(" SELECT ID, P_ID FROM MY_TB order by ordnl_pos ")  
        End If  
End Sub  
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
        If Not IsPostBack Then  
            RadGrid1.MasterTableView.FilterExpression = "P_ID IS NULL" 
        End If  
End Sub 

When the Page loads it displays only the parent rows. The parent rows have the expand/collapse column but no child rows.
If I take out the filter on Page_Load it returns ALL rows but there are at the same level (no hierarchy)
Any suggestions?
Thanks.


Martin
Telerik team
 answered on 12 Jul 2010
1 answer
89 views
Hello I am getting the error for RAD Grid on Version Q1 2010 sp1

I used to get it on Q3 2009 so i upgraded but still the same..
Its urgent ,please.
Any light over this...
Tsvetoslav
Telerik team
 answered on 12 Jul 2010
1 answer
73 views
Now this is very odd.

I am calling a radGrid's AjaxRequest to populate new data once a combobox has a new item selected. The grid is placed within a radPageView.
I am using RadAjaxManager and so I have set the "AjaxSetting's ControlID to the grid's ID ,Everything seem to work as expected. But the grid does not seem to refresh. I can debug the code and see that the server side code does fireup and the grid rebinds successfully. It just does not show up on screen

So how come this behavior actually changes depending on the platform the ASP application runs on? And why doesn't the grid refresh in first place?

Thanks for your support!

Best regards,
ANu
Tsvetoslav
Telerik team
 answered on 12 Jul 2010
5 answers
240 views
Hi,
    Scenario:
In telerik grid I have six columns,and grid have 1000+ records.Suppose a user select 10 records from this .I want to have a validation in which user had selected right columns or not.For this I have to Get the vlaue of 3 rd column from grid for the selected records and have check  and based on the result i have to show a message.

How can we get the 3rd column value from grid for the selected records.For selecting row i am using client select column

Thanks
A2H
A2H
Top achievements
Rank 1
 answered on 12 Jul 2010
1 answer
91 views
Is there any way to nest the DetailTable (i.e. child rows) inside a column of each parent item in the grid? (instead of the user having to click on the expand button to show the child rows for each parent item) I want the grid to show each parent along with their children upon page load (the child rows would be embedded in a column within each parent).
Veli
Telerik team
 answered on 12 Jul 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?