当前位置:编程学习 > C#/ASP.NET >>

在线!问题紧急高手们GO GO GO !!!!!!!

 <asp:DataList ID="dt_title" runat="server" 
              onitemdatabound="dt_title_ItemDataBound" CellPadding="4" 
              ForeColor="#333333" Height="110px"  Width="645px" >
              <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
              <AlternatingItemStyle BackColor="#F5F8F9" ForeColor="#284775" />
              <ItemStyle BackColor="#E8E8E8" ForeColor="#333333" VerticalAlign="Middle" />
              <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="Red" />
              <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <ItemTemplate>
            <div style=" float:left; color:#006699; font-size:14px; font-weight:bold; width:60px; padding-left:15px; padding-top:5px;">
              <asp:Label ID="lbl_title" runat="server"><%# Eval("Sname")%></asp:Label>
             </div>
                <div style="margin-left:60px; line-height:12px; width:498px;">
                    <asp:DataList ID="dt_Name" runat="server" RepeatColumns="6" 
                        RepeatDirection="Horizontal" onitemcommand="dt_Name_ItemCommand" 
                        onitemdatabound="dt_Name_ItemDataBound" >
                        <ItemTemplate>
                             <div style=" " class="menu">
                              <asp:LinkButton ID="lb_Content"  runat="server"
                              PostBackUrl='<%# "~/FantPage/listMenu.aspx?tid="+Eval("tid")%>' CommandName='<%#Eval("TName")%>' ForeColor='<%#GetColor(Eval("TName").ToString()) %>'   CommandArgument='<%#Eval("tid")%>' oncommand="lb_Content_Command"><%# Eval("TName")%></asp:LinkButton>
                             </div>
                        </ItemTemplate>
                    </asp:DataList>
                </div>
            </ItemTemplate>
          </asp:DataList>
点击linkbutton改变颜色 --------------------编程问答-------------------- 有够乱的了!!!



--------------------编程问答-------------------- --------------------编程问答-------------------- LinkButton 在页面转换成<a href=""></a>
用a 标签
a{ color:black; text-decoration:none;}
a:hover{ color:red;} --------------------编程问答-------------------- 能说的清楚点吗? --------------------编程问答-------------------- 给a标签 加样式。 --------------------编程问答-------------------- --------------------编程问答-------------------- 点击linkbutton改变当前颜色,后台通过下面的代码实现,但是出现了回传的问题
protected void lb_Content_Command(object sender, CommandEventArgs e)
    {
      Session["Name1"]= e.CommandArgument.ToString();    }
    protected void dt_Name_ItemCommand(object source, DataListCommandEventArgs e)
    {  
       string ID = Request.QueryString["tid"].ToString();
       if (ID != "")
         {
           string IDtext = ID.Substring(0, 1);
            Content(IDtext, ID);
         }
        int sid = int.Parse(Session["order"].ToString());
        string sids = Session["Name1"].ToString();
       
        DataList dl = (DataList)dt_title.Controls[sid].FindControl("dt_Name");
        LinkButton lb = (LinkButton)dl.Controls[e.Item.ItemIndex].FindControl("lb_Content");
        lb.ForeColor = System.Drawing.Color.Blue;
            lb.ForeColor = System.Drawing.Color.Black;
            if (ID == sids)
            {
                lb.ForeColor = System.Drawing.Color.Red;
            }
    } --------------------编程问答-------------------- 点击之后改变颜色有哪位高人指点一下小生,3Q了 --------------------编程问答--------------------  LinkButton lb = (LinkButton)dl.Controls[e.Item.ItemIndex].FindControl("lb_Content");
 lb.ForeColor = System.Drawing.Color.Blue;
  lb.ForeColor = System.Drawing.Color.Black;
  if (ID == sids)
  {
  lb.ForeColor = System.Drawing.Color.Red;
  }
...为什么这么烦琐
这两个控件事件在一个页面就别这么麻烦了,直接lb_Content.ForeColor = Color.Black; --------------------编程问答--------------------

    <style type="text/css">
         a{color:red;}
         a:linked{color:yellow;}
         a:hover{color:purple;}
    </style>

将上面的代码复制到你的页面上 --------------------编程问答--------------------
引用 10 楼 xxc3303 的回复:
HTML code

    <style type="text/css">
         a{color:red;}
         a:linked{color:yellow;}
         a:hover{color:purple;}
    </style>


将上面的代码复制到你的页面上

试试 --------------------编程问答-------------------- 以上这些方法俺都试用过没有成功
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,