触摸屏租赁
Touch screen rental
广告机租赁
Advertising rental
机器人租赁
Robot leasing
 当前位置:首页 > > datalist里的第一行记录变红、下划线、加粗怎实现?

datalist里的第一行记录变红、下划线、加粗怎实现?

前台:
<asp:DataList ID="DataListanews3" runat="server" Width="100%" CellPadding="0"  Height="115px" onitemdatabound="DataListanews3_ItemDataBound">
<ItemTemplate><strong>·</strong> <a href="W_NEWSVIEW.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID")%>"><%#jiequtop(Eval("title"), 22)%></a>
</ItemTemplate>
</asp:DataList>

后台:
        protected void DataListanews3_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemIndex == 0)
            {
                e.Item.Font.Bold = true;
                //e.Item.ForeColor = System.Drawing.Color.Red;//变红
                //e.Item.Font.Underline = true;//下划线
            }
        }

或者:
直接后台构造
//科研项目列表2
            StringBuilder sbpro2 = new StringBuilder();
            sbpro2.Append("<table width='99%' border='0' cellspacing='0' cellpadding='0'>");
            Hashtable htpro2 = new Hashtable();
            DataTable dtpro2 = bllpro.GetTable(htpro2);
            if (dtpro2.Rows.Count != 0 && dtpro2 != null)
            {
                //for (int i = 0; i < dtpro2.Rows.Count; i++)
                for (int i = 0; i < 4; i++)
                {
                    sbpro2.Append("<tr>");
                    sbpro2.Append("<td height='25' align='left'>");
                    sbpro2.Append("<strong>·</strong> ");
                    sbpro2.Append("<A href=W_PROJECTVIEW.aspx?NO=" + dtpro2.Rows[i]["NO"] + ">");
                    if (i == 0)
                    {
                        sbpro2.Append("<strong>");
                    }
                    sbpro2.Append(dtpro2.Rows[i]["XMMC"]);
                    if (i == 0)
                    {
                        sbpro2.Append("</strong>");
                    }
                    sbpro2.Append("</A>");
                    sbpro2.Append("</td>");
                    sbpro2.Append("</tr>");
                }
            }
            sbpro2.Append("</table>");
            proStr2 = sbpro2.ToString();

 


工作室地址:重庆石桥铺电脑城B座 | 微信:z35544216 | 网址:www.35544216.com