主题:鼠标移动到literal 控件上根据literal 的text值来显示文字。
<asp:Repeater ID="Repeater1" runat="server"
onitemdatabound="Repeater1_ItemDataBound">
<ItemTemplate >
<div style=" height:auto; display:table; text-align:left;">
<span style="color:#FF9933;"><%#Eval("username")%>
<%-- 显示星星的数目 --%>
<asp:literal id ="div_star" runat ="server" ></asp:literal>
<%# Eval("adddate")%></span><br />
<a> 标题:<%#Eval("title") %></a><br />
内容:<%#Eval("content")%><br /> <br />
</div>
<asp:Panel ID="Panel1" runat="server">
<asp:Label ID="LabelreplyCount" runat="server" Text='<%#Eval("reply") %>'></asp:Label>
<asp:Label ID="LabelreplyData" runat="server" Text='<%# Eval("replydate") %>' ></asp:Label> <br />
<br />
</asp:Panel>
<br />
</ItemTemplate>
</asp:Repeater>
//显示星星数目
public string HandleStar(int num)
{
string strFlag = string.Empty;
for (int i = 0; i < num; i++)
{
strFlag += "<img src=\"../images/pingfen1.gif\"/>";
}
return strFlag;
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
DataRowView drv=e.Item.DataItem as DataRowView;
Literal div_stars = e.Item.FindControl("div_star") as Literal;
if (drv["mark"] != null && drv["mark"].ToString () != "")
{
div_stars.Text = HandleStar(Convert.ToInt32(drv["mark"].ToString()));
}
else
{
div_stars.Text = "";
}
if (drv!=null&&drv["reply"] == null)
{
e.Item.FindControl("Panel1").Visible = false;
}
}
怎么来做鼠标移动上去的事件呢?是根据,div_stars.text的值来显示什么文字的,
onitemdatabound="Repeater1_ItemDataBound">
<ItemTemplate >
<div style=" height:auto; display:table; text-align:left;">
<span style="color:#FF9933;"><%#Eval("username")%>
<%-- 显示星星的数目 --%>
<asp:literal id ="div_star" runat ="server" ></asp:literal>
<%# Eval("adddate")%></span><br />
<a> 标题:<%#Eval("title") %></a><br />
内容:<%#Eval("content")%><br /> <br />
</div>
<asp:Panel ID="Panel1" runat="server">
<asp:Label ID="LabelreplyCount" runat="server" Text='<%#Eval("reply") %>'></asp:Label>
<asp:Label ID="LabelreplyData" runat="server" Text='<%# Eval("replydate") %>' ></asp:Label> <br />
<br />
</asp:Panel>
<br />
</ItemTemplate>
</asp:Repeater>
//显示星星数目
public string HandleStar(int num)
{
string strFlag = string.Empty;
for (int i = 0; i < num; i++)
{
strFlag += "<img src=\"../images/pingfen1.gif\"/>";
}
return strFlag;
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
DataRowView drv=e.Item.DataItem as DataRowView;
Literal div_stars = e.Item.FindControl("div_star") as Literal;
if (drv["mark"] != null && drv["mark"].ToString () != "")
{
div_stars.Text = HandleStar(Convert.ToInt32(drv["mark"].ToString()));
}
else
{
div_stars.Text = "";
}
if (drv!=null&&drv["reply"] == null)
{
e.Item.FindControl("Panel1").Visible = false;
}
}
怎么来做鼠标移动上去的事件呢?是根据,div_stars.text的值来显示什么文字的,