如何将提示添加到绑定列在一个DetailsView,但仅当列的颜色已经改变 [英] How to add a tooltip to Boundfields in a Detailsview, but only if color of column has changed
问题描述
我有以下的code ...
I have the following code ...
<asp:DetailsView ID="dvApprenticeship" runat="server" DataSourceID="dsApprenticeship" AutoGenerateRows="false" BackColor="#E0E8F0" GridLines="None" CellPadding="2"
DataKeyNames="ProgramID, ProgramName, OrganisationName, StudyYearID, Workgroup, Pathway, FinishDate" OnDataBound="Apprenticeship_DataBound">
<Fields>
<asp:BoundField DataField="ProgramName" HeaderText="Program:" />
<asp:BoundField DataField="StudyYearName" HeaderText="Study Year:" />
<asp:HyperLinkField DataTextField="OrganisationName" HeaderText="Apprenticeship: " NavigateUrl="Apprenticeships.aspx" />
<asp:BoundField DataField="Workgroup" HeaderText="Workgroup:" />
<asp:BoundField DataField="Pathway" HeaderText="Pathway:" />
<asp:TemplateField HeaderText="Nominal Completion: ">
<ItemTemplate>
<asp:Label ID="labEndDate" runat="server" Text='<%# Eval("FinishDate","{0:d/MM/yyyy}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Fields>
<FooterTemplate>
<asp:LinkButton ID="lbAddProgramUnits" runat="server" OnClick="AddProgramUnits_Click" ForeColor="White" Font-Bold="true"
OnClientClick="return confirm('Import the Program Units listed - this may overwrite unit dates. Are you sure?');">Import from Program</asp:LinkButton>
<a href="#" onclick="showhelp('progimphelp');" style="color:White;font-weight:bold;">Help</a>
</FooterTemplate>
<FooterStyle HorizontalAlign="Center" BackColor="LightSlateGray" />
</asp:DetailsView>
我希望能够展现每当上述绑定列已更改颜色的提示。
I want to be able to show a tooltip whenever one of the above Boundfields has changed color.
在我的C#codebehind,我有code,改变依赖于数据的某些情况下,这些绑定列的颜色。这是工作的罚款。
In my C# codebehind, I have code that changes the color of these boundfields depending on certain conditions of the data. This is working fine.
但我想要的是能够给用户一个提示当过他们将其鼠标在这些绑定列且仅当此字段是不同的色彩,在我的情况
But what I want is to be able to give the users a tooltip when ever they hover their mouse over these Boundfields and ONLY if that field is coloured differently, in my case
color.Yellow
color.Yellow
推荐答案
如果您在颜色设置为黄色在DetailsView根据某些条件,您可以数据绑定
事件设置提示在同一区块:
If you are setting the color to yellow in the DetailsView DataBound
event based on some criteria, you can set the tooltip in that same block:
DetailsViewRow.Cells[indexofyellowfield].ToolTip = "some help from code-behind";
这篇关于如何将提示添加到绑定列在一个DetailsView,但仅当列的颜色已经改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!