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

Show Hide Tooltip Inside Rad Grid

1 Answer 303 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tracy
Top achievements
Rank 1
Tracy asked on 25 Jul 2012, 02:47 AM
Hi,

I have a radtooltip that I am displaying on each datarow of the grid.  The tooltip is a usercontrol that I am loading on the RadGrid_ItemDatabound event.  I am trying to give the user the option of either hiding or displaying the tooltip.  I have a button (toggle) in the command item template to show/hide the tooltip.  I am setting a session variable based on the toggle state of the button on the buttons ToggleStateChanged event and then am using the variable to set the visibility of the tooltip.  My problem is that this isn't working, the item databound event of the grid is firing before the buttons togglestatechanged event.

Can you tell me how I can show or hide the tooltip.  I am doing this server side but if it can be done client side that would be great.

    <telerik:RadAjaxPanel ID="rapMainGrid" runat="server">
 
<telerik:RadGrid ID="rgvMainGrid"        runat="server"  DataSourceID="SQLDS_ForecastedCostEntry"
                     EnableEmbeddedSkins="true"          Skin="Office2010Silver"            Height="400px"  Width="1230px"
                     EnableViewState="true"             AutoGenerateColumns="false"     AllowMultiRowSelection="false"     
                     AllowAutomaticDeletes="false"       AllowAutomaticInserts="false"    AllowAutomaticUpdates="false"        EnableLinqExpressions="false"                                                                       
                     EnableHeaderContextMenu="true"     EnableHeaderContextFilterMenu="true"          
                     AllowFilteringByColumn="false"     AllowSorting="true"              AllowPaging="true"                  PageSize="1000">                                 
         
        <HeaderStyle Font-Bold="true" HorizontalAlign ="Center"  VerticalAlign="Middle" Wrap="false" font-size="10px"/>
        <ItemStyle HorizontalAlign="Right" />
        <AlternatingItemStyle HorizontalAlign="Right" />
        <HeaderStyle HorizontalAlign="Center"  Width="40px"/>      
             <HeaderContextMenu Skin="WebBlue"     EnableEmbeddedSkins="true"   />          
        <PagerStyle AlwaysVisible="true"    Mode="NextPrevNumericAndAdvanced" />
        <FooterStyle HorizontalAlign="Right" Font-Bold="true"/>                           
        <ClientSettings AllowColumnsReorder="true"   AllowDragToGroup="false"   AllowColumnHide="false" ReorderColumnsOnClient="true" EnablePostBackOnRowClick="false"  AllowExpandCollapse="true" EnableRowHoverStyle  = "true" >                           
            <ClientEvents OnRowClick="RowSelected"   OnCommand="GridCommand" OnRowDblClick="RowDblClick"  OnGridCreated ="GridScroll"  />
            <Selecting  AllowRowSelect="true"  />                               
            <Resizing   AllowColumnResize="True"    AllowRowResize="False"          ResizeGridOnColumnResize="false" EnableRealTimeResize="True"      ></Resizing>                                     
            <Scrolling  AllowScroll="True"          UseStaticHeaders="True"         SaveScrollPosition="true"       FrozenColumnsCount="4" />
            <KeyboardNavigationSettings AllowSubmitOnEnter="false" />
        </ClientSettings>
        <ExportSettings  HideStructureColumns="true"    ExportOnlyData="true"       IgnorePaging="true"             OpenInNewWindow="true"  />
        <MasterTableView    DataSourceID="SQLDS_ForecastedCostEntry"           Name="MasterGrid"
                            EnableViewState="true"                  AllowMultiColumnSorting="true"       ShowFooter="true"  ShowGroupFooter="true" ShowHeadersWhenNoRecords="true"                             
                            EditMode="InPlace"                      CommandItemDisplay="Top"  DataKeyNames="LaborTrxKey" >                                                               
        <CommandItemTemplate>
            <asp:Table ID="tblCommandTemplate" runat="server"  Width="1230px" CellSpacing="0" CellPadding="0" >
                <asp:TableRow ID="trowCommandTemplate1" runat="server"  Height="30px" style="display:block;margin-bottom:2px"   >
                    <asp:TableCell>
                        <telerik:RadButton ID="rbtAdd"             runat="server" CommandName="InitInsert" OnClientClicked="DisableSelectionFields"    Skin="Transparent" Text="Add"              Icon-PrimaryIconURL="<%$ Resources:Images,AddRecord16%>"    style="position:absolute;left:10px;font-size:12px;"  ToolTip="Add New Record"     Visible='<%# rgvMainGrid.EditIndexes.Count=0 and Not rgvMainGrid.MasterTableView.IsItemInserted %>'    />  
                        <telerik:RadButton ID="rbtCancel"          runat="server" OnClientClicked="CancelEdit"   Skin="Transparent" Text="Cancel"           Icon-PrimaryIconURL="<%$ Resources:Images,CancelRecord16%>" style="position:absolute;left:10px;font-size:12px;"  ToolTip="Cancel Add/Edit"    Visible='<%# rgvMainGrid.EditIndexes.Count > 0 Or rgvMainGrid.MasterTableView.IsItemInserted %>'    AutoPostBack="false" />  
                        <telerik:RadButton ID="rbtSaveNew"         runat="server" CommandName="PerformInsert"    Skin="Transparent" Text="Save"             Icon-PrimaryIconURL="<%$ Resources:Images,SaveRecord16%>"   style="position:absolute;left:80px;font-size:12px;"  ToolTip="Save New Record"    Visible='<%# rgvMainGrid.MasterTableView.IsItemInserted%>'                                           />   
                        <telerik:RadButton ID="rbtSave"            runat="server" OnClientClicked="EnableSelectionFields" CommandName="UpdateEdited"     Skin="Transparent" Text="Save"             Icon-PrimaryIconURL="<%$ Resources:Images,SaveRecord16%>"   style="position:absolute;left:80px;font-size:12px;"  ToolTip="Save Edited Record" Visible='<%# rgvMainGrid.EditIndexes.Count > 0 AND Not rgvMainGrid.MasterTableView.IsItemInserted%>'/>  
                        <telerik:RadButton ID="rbtShowHideToolTip" runat="server" Skin="Transparent" ButtonType="StandardButton" ToggleType="CustomToggle"    OnToggleStateChanged="rbtShowHideTooltip_ToggleStateChanged" AutoPostBack="true"  ToolTip="Show/Hide Line Item Tooltip" style="position:absolute;left:650px;font-size:12px;" EnableViewState="true">
                            <ToggleStates>
                                <telerik:RadButtonToggleState Text=" Hide Tooltip"  PrimaryIconUrl="<%$ Resources:Images,YellowTooltip16%>"   />
                                <telerik:RadButtonToggleState Text=" Show Tooltip"  PrimaryIconUrl="<%$ Resources:Images,YellowTooltip16%>"  Selected="true"  />
                            </ToggleStates>
                        </telerik:RadButton>
                         
                        <telerik:RadButton ID="rbtShowHideTotals"  runat="server"                                Skin="Transparent" ButtonType="StandardButton" ToggleType="CustomToggle"  OnClientToggleStateChanged="ShowHideTotals" AutoPostBack="false"  ToolTip="Show/Hide Job/Cost Code Totals"   style="position:absolute;left:968px;font-size:12px;"   OnClientLoad="ShowTotalsLoad"  Visible='<%# rgvMainGrid.EditIndexes.Count=0 and Not rgvMainGrid.MasterTableView.IsItemInserted %>'>
                            <ToggleStates>
                                <telerik:RadButtonToggleState Text=" Hide Totals"  PrimaryIconUrl="<%$ Resources:Images,BlueTotals16%>"  Selected="true" />
                                <telerik:RadButtonToggleState Text=" Show Totals"  PrimaryIconUrl="<%$ Resources:Images,BlueTotals16%>"    />
                            </ToggleStates>
                        </telerik:RadButton>
                        <telerik:RadButton ID="rbtPrevious"        runat="server" CommandName="PreviousWeek"     Skin="Transparent" Text="Previous"         Icon-PrimaryIconURL="<%$ Resources:Images,ArrowGrayLeft%>"   style="position:absolute;left:1075px;font-size:12px;"  ToolTip="Show Previous 8 Weeks"  Visible='<%# rgvMainGrid.EditIndexes.Count=0 and Not rgvMainGrid.MasterTableView.IsItemInserted %>'/>  
                        <telerik:RadButton ID="rbtNext"            runat="server" CommandName="NextWeek"         Skin="Transparent" Text="Next"             Icon-PrimaryIconURL="<%$ Resources:Images,ArrowGrayRight%>"   style="position:absolute;left:1155px;font-size:12px;"  ToolTip="Show Next 8 Weeks" Visible='<%# rgvMainGrid.EditIndexes.Count=0 and Not rgvMainGrid.MasterTableView.IsItemInserted %>'/>  
                         
                    </asp:TableCell>
                </asp:TableRow>
           </asp:Table>
</CommandItemTemplate>
                <Columns>  
                    <telerik:GridBoundColumn        UniqueName="LaborTrxKey"            DataField="LaborTrxKey"             Display="false" />
                    <telerik:GridBoundColumn        UniqueName="ArgusDBID"              DataField="ArgusDBID"               Display="false" />
                    <telerik:GridBoundColumn        UniqueName="JobName"                DataField="JobName"                 Display="false" />
                    <telerik:GridBoundColumn        UniqueName="ExtraDescription"       DataField="ExtraDescription"        Display="false" />
                    <telerik:GridBoundColumn        UniqueName="CostCodeDescription"    DataField="CostCodeDescription"     Display="false" />
                    <telerik:GridBoundColumn        UniqueName="CostCodeDiscipline"     DataField="CostCodeDiscipline"      Display="false" />
                    <telerik:GridBoundColumn        UniqueName="ContractType"           DataField="ContractType"            Display="false" />
                    <telerik:GridBoundColumn        UniqueName="ProjectManager"         DataField="ProjectManager"          Display="false" />
                    <telerik:GridBoundColumn        UniqueName="LaborRateTable"         DataField="LaborRateTable"          Display="false" />
                    <telerik:GridBoundColumn        UniqueName="EmployeeNumber"         DataField="EmployeeNumber"          Display="false" />
                    <telerik:GridBoundColumn        UniqueName="EmployeeIdentity"       DataField="EmployeeIdentity"        Display="false" />
                    <telerik:GridBoundColumn        UniqueName="EmployeeDiscipline"     DataField="EmployeeDiscipline"      Display="false" />
                    <telerik:GridBoundColumn        UniqueName="LaborType"              DataField="LaborType"               Display="false" />
                    <telerik:GridBoundColumn        UniqueName="TransactionType"        DataField="TransactionType"         Display="false" />
                    <telerik:GridTemplateColumn     UniqueName="gtcJob"                 DataField="Job"             HeaderText="Job"  HeaderStyle-Width="120px"  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Image ID="imgTrxType"  runat="server"  ImageURL='<%# Bind("TrxImage") %>'   />
                            <asp:Label ID="lblJob"      runat="server"  Text='<%# Bind("Job") %>'  />
             <telerik:RadToolTip runat="server" Width="400" RenderInPageRoot="true" ShowEvent="OnMouseOver" 
                                HideEvent="LeaveTargetAndToolTip" ID="RadToolTip1" Position= "TopRight" Animation="Resize"
                                RelativeTo="Mouse" OffsetX="10" OffsetY="10"    >
                                </telerik:RadToolTip>
 
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Image ID="imgTrxTypeEdit"  runat="server"  ImageURL='<%# Bind("TrxImage") %>'   />
                            <asp:Label ID="lblJobEdit"      runat="server"  Text='<%# Bind("Job") %>'  />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <telerik:RadComboBox runat="server" ID="rcbInsertJob"   DataSourceID="SQLDS_JobNumber" DataValueField="Job"   DataTextField="Job"        
                                     AllowCustomText="false"   AutoPostBack="true"    MarkFirstMatch="true" 
                                     HighlightTemplatedItems="true"   ItemsPerRequest="200" ShowMoreResultsBox="true"   Skin="Default"
                                     EnableEmbeddedSkins="true"           Width="105px"          DropDownWidth="120px"  
                                     OnItemDataBound="rcbInsertJob_ItemDataBound" OnSelectedIndexChanged="rcbInsertJob_SelectedIndexChanged"                >
                            </telerik:RadComboBox>
                        </InsertItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn     UniqueName="gtcExtra"           HeaderText="Extra"  HeaderStyle-Width="80px"   ItemStyle-HorizontalAlign="Left" >
                        <ItemTemplate>
                            <asp:Label ID="lblExtra" runat="server" Text='<%# Bind("Extra") %>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblExtraEdit" runat="server" Text='<%# Bind("Extra") %>' />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                             <telerik:RadComboBox runat="server"    ID="rcbInsertExtra"             DataValueField="Extra"   DataTextField="Extra" 
                                     EnableViewState="true"         EnableLoadOnDemand="true"       AllowCustomText="true"   AutoPostBack="false"        MarkFirstMatch="true"    HighlightTemplatedItems="true"
                                     EnableEmbeddedSkins="true"     Skin="Default"                  Width="100px"            DropDownWidth="100px"       OnItemsRequested="rcbInsertExtra_ItemsRequested"    >                                                        
                            </telerik:RadComboBox>
                        </InsertItemTemplate>                                           
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn     UniqueName="gtcCostCode"   HeaderText="Cost Code"   HeaderStyle-Width="80px"   ItemStyle-HorizontalAlign="Left"   >
                        <ItemTemplate>
                            <asp:Label ID="lblCostCode" runat="server" Text='<%# Bind("CostCode") %>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblCostCodeEdit" runat="server" Text='<%# Bind("CostCode") %>' />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <telerik:RadComboBox runat="server"     ID="rcbInsertCostCode"          DataValueField="CostCode"    DataTextField="CostCode"                                  
                                     EnableViewState="true"         EnableLoadOnDemand="true"       AllowCustomText="true"       AutoPostBack="false"        MarkFirstMatch="true"    HighlightTemplatedItems="true"
                                     EnableEmbeddedSkins="true"     Skin="Default"                  Width="100px"                DropDownWidth="100px"       OnItemsRequested="rcbInsertCostCode_ItemsRequested"    >
                             </telerik:RadComboBox>
                        </InsertItemTemplate>                                           
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn     UniqueName="gtcEmployeeName"   HeaderText="Employee Name"  HeaderStyle-Width="150px"   ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblEmployeeName" runat="server" Text='<%# Bind("EmployeeName") %>' Width="130px" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Label ID="lblEmployeeNameEdit" runat="server" Text='<%# Bind("EmployeeName") %>' Width="130px" />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                         
                            <telerik:RadComboBox runat="server" ID="rcbInsertEmployee"   DataSourceID="SQLDS_EmployeeName" DataValueField="EmployeeIdentity"   DataTextField="EmployeeName"        
                                     AllowCustomText="false"   AutoPostBack="false"    MarkFirstMatch="true" 
                                     HighlightTemplatedItems="true"   EnableEmbeddedSkins="true"    Skin="Default"       Width="170px"          DropDownWidth="170px"  
                                     OnItemDataBound="rcbInsertEmployee_ItemDataBound"                >
                            </telerik:RadComboBox>
                        </InsertItemTemplate>                                           
                    </telerik:GridTemplateColumn>  
                    <telerik:GridBoundColumn    DataField="BeginningHours"                  UniqueName="BeginningHours"                 HeaderText="JTD"        DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="70px"    ReadOnly="true"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek1"                      UniqueName="HoursWeek1"                     HeaderText="Week1"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor1"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek2"                      UniqueName="HoursWeek2"                     HeaderText="Week2"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor2"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek3"                      UniqueName="HoursWeek3"                     HeaderText="Week3"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor3"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek4"                      UniqueName="HoursWeek4"                     HeaderText="Week4"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor4"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek5"                      UniqueName="HoursWeek5"                     HeaderText="Week5"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor5"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek6"                      UniqueName="HoursWeek6"                     HeaderText="Week6"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor6"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek7"                      UniqueName="HoursWeek7"                     HeaderText="Week7"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor7"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek8"                      UniqueName="HoursWeek8"                     HeaderText="Week8"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor8"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek9"                      UniqueName="HoursWeek9"                     HeaderText="Week8"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor9"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek10"                      UniqueName="HoursWeek10"                     HeaderText="Week8"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor10"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek11"                      UniqueName="HoursWeek11"                     HeaderText="Week8"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor11"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeek12"                      UniqueName="HoursWeek12"                     HeaderText="Week8"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="55px"    ColumnEditorID="HrsEditor12"   DefaultInsertValue="0.00"/>
                    <telerik:GridNumericColumn  DataField="HoursWeekFuture"                 UniqueName="HoursWeekFuture"                HeaderText="WeekFuture" DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="65px"    ReadOnly="true"  />
                    <telerik:GridNumericColumn  DataField="HoursTotal"                      UniqueName="HoursTotal"                     HeaderText="Total"      DataFormatString="{0:F2}" Aggregate="Sum"      HeaderStyle-Width="60px"    ReadOnly="true"  />
                    <telerik:GridBoundColumn    DataField="CostTotals"                      UniqueName="CostTotals"                     HeaderText="CostTotals" Display="false"/>
            </Columns>         
            <FooterStyle />                     
        </MasterTableView>
         
    </telerik:RadGrid>
    <telerik:GridNumericColumnEditor ID="HrsEditor1" runat="server"
        <NumericTextBox  runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
 
    <telerik:GridNumericColumnEditor ID="HrsEditor2" runat="server"
        <NumericTextBox  runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
 
    <telerik:GridNumericColumnEditor ID="HrsEditor3" runat="server"
        <NumericTextBox   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
 
    <telerik:GridNumericColumnEditor ID="HrsEditor4" runat="server"
        <NumericTextBox   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
 
    <telerik:GridNumericColumnEditor ID="HrsEditor5" runat="server"
        <NumericTextBox   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
 
    <telerik:GridNumericColumnEditor ID="HrsEditor6" runat="server"
        <NumericTextBox  runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
 
    <telerik:GridNumericColumnEditor ID="HrsEditor7" runat="server"
        <NumericTextBox   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
   
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
 
    <telerik:GridNumericColumnEditor ID="HrsEditor8" runat="server"
        <NumericTextBox   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
    <telerik:GridNumericColumnEditor ID="HrsEditor9" runat="server"
        <NumericTextBox ID="NumericTextBox1"   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
    <telerik:GridNumericColumnEditor ID="HrsEditor10" runat="server"
        <NumericTextBox ID="NumericTextBox2"   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
    <telerik:GridNumericColumnEditor ID="HrsEditor11" runat="server"
        <NumericTextBox ID="NumericTextBox3"   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
     
    <telerik:GridNumericColumnEditor ID="HrsEditor12" runat="server"
        <NumericTextBox ID="NumericTextBox4"   runat="server"  Width="55px"  DataType="System.Decimal"  Font-Size="12px"  MinValue ="0" MaxValue="80" >
            <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true" />
            <EnabledStyle HorizontalAlign="Right" />
            <FocusedStyle HorizontalAlign="Right"  BackColor="#FAF1B1"/>
            <DisabledStyle HorizontalAlign="Right" BackColor ="<%$ Resources:Colors,BlueBright%>"   />                               
        </NumericTextBox>
    </telerik:GridNumericColumnEditor>
</telerik:RadAjaxPanel>

Protected Sub rbtShowHideTooltip_ToggleStateChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.ButtonToggleStateChangedEventArgs)
 
       If e.SelectedToggleStateIndex.ToString = "0" Then
           Session("ShowToolTip") = True
       Else
           Session("ShowToolTip") = False
       End If
       'Force Grid Item Databound Event
       rgvMainGrid.Rebind()
 
   End Sub
 
   Private Sub rgvMainGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgvMainGrid.ItemDataBound
       Dim gciItem As GridCommandItem = TryCast(Me.rgvMainGrid.MasterTableView.GetItems(GridItemType.CommandItem)(0), GridCommandItem)
       Dim rbtToolTip As RadButton = TryCast(gciItem.FindControl("rbtShowHideToolTip"), RadButton)
 
       If TypeOf e.Item Is GridDataItem Or TypeOf e.Item Is GridEditableItem Then
           Dim Row As GridDataItem = DirectCast(e.Item, GridDataItem)
           Dim strExtra As String = Nothing
           'Set the ToolTip for each grid row
           If Not TypeOf e.Item Is GridDataInsertItem Then
               MsgBox(rbtToolTip.SelectedToggleState.Text)
               Dim ToolTip As RadToolTip = DirectCast(e.Item.FindControl("RadToolTip1"), RadToolTip)
               ToolTip.Visible = Session("ShowToolTip")
               If Session("ShowToolTip") = True Then
                   If Not (TryCast(Row.FindControl("lblExtra"), Label).Text.Trim().Equals(" ") Or TryCast(Row.FindControl("lblExtra"), Label).Text.Trim().Length = 0) Then
                       strExtra = TryCast(Row.FindControl("lblExtra"), Label).Text
                   Else
                       strExtra = "*"
                   End If
 
                   Dim strParameters As String = TryCast(Row.FindControl("lblJob"), Label).Text + "," + _
                                                 Row("JobName").Text + "," + _
                                                 TryCast(Row.FindControl("lblExtra"), Label).Text + "," + _
                                                 Row("ExtraDescription").Text + "," + _
                                                 TryCast(Row.FindControl("lblCostCode"), Label).Text + "," + _
                                                 Row("CostCodeDescription").Text + "," + _
                                                 Row("CostCodeDiscipline").Text + "," + _
                                                 TryCast(Row.FindControl("lblEmployeeName"), Label).Text + "," + _
                                                 Row("EmployeeDiscipline").Text
 
                   ToolTip.IsClientID = True
                   ToolTip.TargetControlID = e.Item.ClientID
                   Dim ToolTipInfo As WUC_PRJ_Forecasting_Tooltip = DirectCast(Page.LoadControl("WUC PRJ Forecasting ToolTip.ascx"), WUC_PRJ_Forecasting_Tooltip)
                   ToolTipInfo.prpPageParameters = strParameters
                   ToolTip.Controls.Add(ToolTipInfo)
                   MsgBox("Tooltip Visible")
               Else
                   MsgBox("Tooltip Hidden")
               End If
           End If
           'Set the Background color of the Hours fields based on the type of hours (Actual or Forecasted) and if the field has a value.
           Dim strColumn As String
           Dim i As Integer = 0
           For i = 0 To 14
               Select Case i
                   Case 12
                       strColumn = "BeginningHours"
                   Case 13
                       strColumn = "HoursWeekFuture"
                   Case 14
                       strColumn = "HoursTotal"
                   Case Else
                       strColumn = "HoursWeek" + (i + 1).ToString
               End Select
 
               If Not (Row(strColumn).Text.Trim().Equals(" ") Or Row(strColumn).Text.Trim().Length = 0) Then
                   If Row(strColumn).Text <> 0 Then
                       Row(strColumn).Font.Bold = "true"
                       Select Case Me.rcbTrxType.SelectedValue.ToString
                           Case "A", "F", "B"
                               If Row("TransactionType").Text = "A" Then
                                   Row(strColumn).BackColor = ColorTranslator.FromHtml(HttpContext.GetGlobalResourceObject("Colors", "BlueBright"))
                               Else
                                   Row(strColumn).BackColor = ColorTranslator.FromHtml(HttpContext.GetGlobalResourceObject("Colors", "GreenBright"))
                               End If
                           Case "C"
                               Dim intDay As Integer = DateDiff(DateInterval.Day, Convert.ToDateTime(Me.txtLastPayroll.Text), Convert.ToDateTime(Me.txtBeginDate.Text))
                               If intDay >= 0 Then
                                   Row(strColumn).BackColor = ColorTranslator.FromHtml(HttpContext.GetGlobalResourceObject("Colors", "GreenBright"))
                               Else
                                   Dim intWeek = Math.Abs(intDay) / 7
                                   If intWeek >= i Then
                                       Row(strColumn).BackColor = ColorTranslator.FromHtml(HttpContext.GetGlobalResourceObject("Colors", "BlueBright"))
                                   Else
                                       Row(strColumn).BackColor = ColorTranslator.FromHtml(HttpContext.GetGlobalResourceObject("Colors", "GreenBright"))
                                   End If
                               End If
                       End Select
                   Else
                       Row(strColumn).BackColor = Color.White
                   End If
               Else
                   Row(strColumn).BackColor = Color.White
                   Row(strColumn).Font.Bold = "false"
               End If
 
           Next
       End If
 
 
       'If Grid is in Insert/Edit mode disable any hour columns that are less than or equal to the the Last Payroll Date
       If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Or TypeOf e.Item Is GridEditFormInsertItem Then
           Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem)
           Dim txtHours As RadNumericTextBox
           Dim strColumn As String
           Dim i As Integer = 0
           'Convert.ToDateTime
           Dim intWeeks As Integer = DateDiff("w", Convert.ToDateTime(Me.txtBeginDate.Text), Convert.ToDateTime(Me.txtLastPayroll.Text))
           If intWeeks >= 0 Then
               For i = 0 To 10
                   strColumn = "HoursWeek" + (i + 1).ToString
                   txtHours = DirectCast(item(strColumn).Controls(0), RadNumericTextBox)
                   If i <= intWeeks Then
                       txtHours.Enabled = False
                   Else
                       txtHours.Enabled = True
                       If i = intWeeks + 1 Then
                           txtHours.Focus()
                       End If
                   End If
               Next i
           Else
               txtHours = DirectCast(item("HoursWeek1").Controls(0), RadNumericTextBox)
           End If
       End If
 
 
 
   End Sub

Any help will be appreciated.

Tracy

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 30 Jul 2012, 06:52 AM
Hello Tracy,

You could try using the RadGrid PreRender event to set up the tooltips as it will fire for sure after the event that triggered the postback. In it, you can loop through rgvMainGrid.MasterTableView.Items, which is a collection of all GridDataItem objects in the master table, to access and populate the tooltips.

Kind regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Tracy
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or