我想更改显示的样式链接按钮行。我想使用此代码,但在选择其他链接按钮行之后选择链接按钮行之前保持样式。
html代码:
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnItemCommand="Repeater1_ItemCommand">
<ItemTemplate>
<div id="div">
<asp:Panel runat="server" aID="pnl">
<asp:LinkButton runat="server" ID="lnkbtn" PostBackUrl='<%#"WebForm1.aspx?Id="+Eval("CategoryGalleryID")%>'
Text='<%#Eval("Title")%>'>
</asp:LinkButton>
</asp:Panel>
</div>
</ItemTemplate>
</asp:Repeater>
C#代码:
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
string ID = Page.Request.QueryString.Get("ID");
LinkButton lnkbtn = (LinkButton)e.Item.FindControl("lnkbtn");
lnkbtn.Font.Bold= true;
}