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

How do I add a Tooltip to the "Cancel" or "Update" icons when you edit a line item in a RadGrid?

1 Answer 189 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 18 Feb 2009, 08:53 PM
When I click to edit a record in a grid, there are 2 icons that are dynamically created: the "Update" icon and the "Cancel" icon.  I want to put a Tooltip on both of those, but being that they are created dynamically, they aren't explicitly defined in the markup.  For example, here's my markup for the grid:

<radG:RadGrid ID="CriteriaGrid" runat="server" GridLines="None" AutoGenerateColumns="False"
                    AllowSorting="True" Height="472px" Width="764px" EnableAJAX="True"
                    OnNeedDataSource="CriteriaGrid_NeedDataSource" OnCreateColumnEditor="CreateEditor"
                    OnItemCreated="CriteriaGrid_ItemCreated" OnItemDataBound="CriteriaGrid_ItemDataBound"
                    OnInsertCommand="CriteriaGrid_InsertCommand" OnUpdateCommand="CriteriaGrid_UpdateCommand"
                    OnDeleteCommand="CriteriaGrid_DeleteCommand">
                    <MasterTableView EditMode="InPlace" DataKeyNames="rpcri_pk" CommandItemDisplay="Top"
                        NoMasterRecordsText="" EnableNoRecordsTemplate="False" TableLayout="Fixed">
                        <EditFormSettings EditColumn-ButtonType="ImageButton"/>
                        <CommandItemTemplate>
                            <asp:Button ID="AddCriteria" runat="server" CommandName="InitInsert"
                                CssClass="grButtonLong" Text="Add Criteria"/>
                        </CommandItemTemplate>
                        <Columns>
                            <radG:GridEditCommandColumn ItemStyle-HorizontalAlign="Center" UniqueName="EditCommandColumn" ButtonType="ImageButton"
                                HeaderStyle-Width="20px"/>
                            <radG:GridButtonColumn ItemStyle-HorizontalAlign="Center" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"
                               HeaderStyle-Width="20px" ButtonType="ImageButton"/>
                            <radG:GridDropDownColumn HeaderStyle-HorizontalAlign="center" ItemStyle-HorizontalAlign="Center" DataField="rpcri_and_or" UniqueName="rpcri_and_or"
                                ListTextField="text" ListValueField="value" HeaderStyle-Width="80px"/>
                            <radG:GridDropDownColumn HeaderStyle-HorizontalAlign="Center" DataField="rpcri_rpc_fk" UniqueName="rpcri_rpc_fk"
                                ListTextField="langstring" ListValueField="rpc_pk" HeaderStyle-Width="200px"/>
                            <radG:GridDropDownColumn HeaderStyle-HorizontalAlign="Center" DataField="rpcri_rpcon_fk" UniqueName="rpcri_rpcon_fk"
                                ListTextField="rpcon_description" ListValueField="rpcon_pk" HeaderStyle-Width="120px"/>
                            <radG:GridBoundColumn HeaderStyle-HorizontalAlign="Center" DataField="rpcri_value" UniqueName="rpcri_value"
                                HeaderStyle-Width="128px"/>
                            <radG:GridCheckBoxColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="rpcri_static_field" UniqueName="rpcri_static_field"
                                HeaderStyle-Width="90px"/>
                            <radG:GridCheckBoxColumn  HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" DataField="rpcri_mandatory" UniqueName="rpcri_mandatory"
                                HeaderStyle-Width="90px"/>
                            <radG:GridCheckBoxColumn Visible="false" DataField="rpcri_function_arg" UniqueName="rpcri_function_arg"
                                />
                        </Columns>
                        
                    </MasterTableView>
                    <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True"/>
                        <Resizing AllowColumnResize="True"/>
                    </ClientSettings>
                </radG:RadGrid>

The columns in the above grid are laid out- but when I click to edit a record, the column changes to accommodate those two newly created icons, "Update" and "Cancel".  Please help!!  Thanks.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Feb 2009, 04:28 AM
Hi Mike,

Try the following code snippet for changingt the tooltip of the buttons in the edit form.

CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
    { 
        GridEditFormItem editForm = (GridEditFormItem)e.Item; 
        ImageButton updateButton = (ImageButton)editForm.FindControl("UpdateButton");             
        updateButton.ToolTip = "My Tooltip for Update"
        ImageButton CancelButton = (ImageButton)editForm.FindControl("CancelButton"); 
        CancelButton.ToolTip = "My Tooltip for Cancel"
    } 

Thanks,
Shinu.
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or