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

alt and tooltip text for ExpandImage and CollapseImage

6 Answers 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Heinz
Top achievements
Rank 1
Heinz asked on 10 Sep 2010, 11:28 AM

I'm looking for a way to modify the alt rsp. tooltip text for ExpandCollapseColumn-ExpandImageUrl and ExpandCollapseColumn-CollapseImageUrl. I want to have different text on several pages e.g. in one page simple "collapse", in an other page "more information" and so on.

I did similar with the filter menu in Page_Load

Dim Menu As GridFilterMenu = RadGrid1.FilterMenu

            Dim item As RadMenuItem

 

            For Each item In Menu.Items

                item.BackColor = Color.LightGreen

                'change the text for the StartsWith menu item

                If item.Text = "NoFilter" Then

                    item.Text = "kein Filter"

                End If

And so on.

But I didn't find a similar solution for the ExpandImage and CollapseImage in the ExpandColumn.

Any suggestions, ideas?

Thanks

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Sep 2010, 01:36 PM
Hello Heinz,

Try the following code snippet in PreRender event to set different ToolTip for ExpandCollapse image in grid pages. Please modify the logic based on your requirement.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
      foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
       {
           Button expandcollapsebtn = (Button)item["ExpandColumn"].Controls[0];
           if (item.Expanded)
           {
               if (RadGrid1.CurrentPageIndex == 0)
                   expandcollapsebtn.ToolTip = "Collapse ToolTip";
               else
                   expandcollapsebtn.ToolTip = "Hide More Information";
           }
           else
           {
               if (RadGrid1.CurrentPageIndex == 0)
                   expandcollapsebtn.ToolTip = "Expand ToolTip";
               else
                   expandcollapsebtn.ToolTip = "More Information";
           }
   }

Thanks,
Princy.
0
Heinz
Top achievements
Rank 1
answered on 10 Sep 2010, 02:41 PM
Thanks, but this solution does not work with ImageButton. Tooltip, alt and title  remain still "expand" and "collaps".
I tested expandcollapsebtn.visible = false and the ExpandImage disappears. So the logic seems to work, but not with expandcollapsebtn.tooltip or with expandcollapsebtn.AlternateText.
Regards
Heinz
0
Mira
Telerik team
answered on 14 Sep 2010, 01:53 PM
Hello Heinz,

Please try setting the ExpandTooltip and CollapseTooltip properties in order to implement the desired functionality.

I hope this helps.

Best wishes,
Mira
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
0
Heinz
Top achievements
Rank 1
answered on 15 Sep 2010, 03:02 PM
Thanks, but doesn't work. Im my code expand/collapse is not a grouping functionality but a detail view. So here ist Grid code.
Regards
Heinz
<telerik:RadGrid ID="RadGrid1" runat="server" Culture="de-DE" DataSourceID="SqlDataSourceGrid1"  Skin="Sunset" GridLines="None" Width="630px">
       <MasterTableView AutoGenerateColumns="False"  DataKeyNames="TerminID" ClientDataKeyNames="TerminID"  ShowHeader="false" AlternatingItemStyle-BackColor="#ffffff"
            DataSourceID="SqlDataSourceGrid1" AllowPaging="True" PageSize="5" NoMasterRecordsText="Für diese Auswahl sind leider keine Einträge vorhanden!"
            ExpandCollapseColumn-ButtonType="ImageButton" ExpandCollapseColumn-ExpandImageUrl="Images/info.gif" ExpandCollapseColumn-CollapseImageUrl="Images/collapse.gif"
             HierarchyDefaultExpanded="false"  >
             <Columns>
                <telerik:GridBoundColumn DataField="TerminID" DataType="System.Int32"
                    HeaderText="TerminID" ReadOnly="True" SortExpression="TerminID"
                    UniqueName="TerminID">
                </telerik:GridBoundColumn>
             </Columns>
            <ItemTemplate>
            <div style="width:580px;">
            <div style="margin-top:20px;background:#ffffff;"></div>
            <fieldset style="padding: 10px;">
                <div style="float:left;"><%# WeekdayName(Weekday(Eval("Datum")))%>, <%# Eval("Datum", "{0:dd.MM.yyyy}")%>, <%# DisplayTime(Eval("Uhrzeit"))%> - <%# Eval("TypName")%></div>
                <div style="float:right;"><%# Eval("Festival")%></div>
                <div style="clear:both"><%# Eval("Ortsname")%>, <%# Eval("LocationName")%></div>
                <div style="clear:both"><%# Eval("Titel")%></div>
                <div style="clear:both"><%# Eval("Untertitel")%></div>
            </fieldset>
             
            </div>
            </ItemTemplate>
 
        <DetailTables>
        <telerik:GridTableView DataKeyNames="TerminID" ShowHeader="false" DataSourceID="SqlDataSource2" CssClass="Programm"  runat="server" GridLines="None"
         BorderColor="#ffffff"  >
            <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="TerminID" MasterKeyField="TerminID" />
            </ParentTableRelation>
            <ItemTemplate>
            <div style="width:90%;">
            <fieldset style="margin-left:5px;padding:10px;">
            <legend style="padding: 5px;font-weight:bold;font-size:12px;">Programmdetails zu <%# Eval("Titel")%></legend>
            <div><%# Replace(Eval("Programm"), vbCrLf, "<br/>")%></div>
            <div style="text-align:right;"><%# MakeLink(Eval("Web")) %></div>
            </fieldset>
            </div>
            </ItemTemplate>
        </telerik:GridTableView>
    </DetailTables>
 
        <PagerStyle Mode="NextPrev" Position="TopAndBottom" />
        </MasterTableView>
    </telerik:RadGrid>
0
Mira
Telerik team
answered on 15 Sep 2010, 04:31 PM
Hello Heinz,

I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

I hope it helps.

All the best,
Mira
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
0
Heinz
Top achievements
Rank 1
answered on 15 Sep 2010, 04:46 PM
Works. Great. Thanks.
As so often - to lines of code decide on happy or unhappy   ;-)
Tags
Grid
Asked by
Heinz
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Heinz
Top achievements
Rank 1
Mira
Telerik team
Share this question
or