如何在Asp.net 3.5中闪烁Gridview单元 [英] How to blink Gridview Cell in Asp.net 3.5

查看:56
本文介绍了如何在Asp.net 3.5中闪烁Gridview单元的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

更新鲜的Asp.net,请您清除/解决我的疑问.

我的WEBFORM上有一个GRIDVIEW.
我已经使用SQlserver 2005在GRidview中显示了数据....它很好.

在此GRIDVIEW中,我有两个带有日期的列..... VALID FROM和VALID TO.

对from有效的是cell [4],对from有效的是cell [5]

假设日期VALID FROM大于日期VALID TO .....有效自单元格应该闪烁.

请你告诉我怎么做.

提前致谢.

Dear Friends,

Am Fresher to Asp.net, Please can you Clear/Solve my doubt.

I have a GRIDVIEW on My WEBFORM.
I have Displayed Data in GRidview using SQlserver 2005....its fine.

In this GRIDVIEW I have two Columns with Dates..... VALID FROM and VALID TO.

Valid from is cell[4] and Valid to is Cell[5]

Suppose if the date VALID FROM is Greater than VALID TO..... Valid From cell should be blink.

Please can u show me how to do this.

Thanks in Advance.

推荐答案

假设您在gridview中有两个标签,分别为:
suppose you are having two labels in gridview as :
<asp:TemplateField HeaderText="FromDate">
                    <ItemTemplate>
                        <asp:Label ID="lblFromDate" runat="server" Text='<%#Eval("fromdate") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ToDate">
                    <ItemTemplate>
                        <asp:Label ID="lblToDate" runat="server" Text='<%#Eval("todate") %>'></asp:Label></ItemTemplate>
                </asp:TemplateField>




然后使用DateTime.Compare 函数在RowDataBound Event中比较两个日期,例如:




Then you compare the two dates in RowDataBound Event using DateTime.Compare function such as:

if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label fromdate = (Label)e.Row.FindControl("lblFromDate");
            Label todate = (Label)e.Row.FindControl("lblToDate");
            DateTime fdate = Convert.ToDateTime(fromdate.Text);
            DateTime tdate = Convert.ToDateTime(todate.Text);
            
            if (DateTime.Compare(fdate, tdate) > 0)
            {
                fromdate.Style.Add("text-decoration", "blink");
            }.......



从Google获得有关DateTime.Compare的更多信息.
希望这会有所帮助.



get more infomation about DateTime.Compare from google.
Hope this helps.


这篇关于如何在Asp.net 3.5中闪烁Gridview单元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆