【发布时间】:2016-04-25 09:15:25
【问题描述】:
这是页面的html代码:
<ul class="list quicker">
<li><asp:LinkButton runat="server" ID="education_news" OnClick="education_news_Click" >Education</asp:LinkButton></li>
<li><asp:LinkButton runat="server" ID="immigration_news" OnClick="immigration_news_Click">Immigration</asp:LinkButton></li>
<li><asp:LinkButton runat="server" ID="visa_news" OnClick="visa_news_Click" >Visa</asp:LinkButton></li>
</ul>
这是我使用过的页面背后的代码:
protected void education_news_Click(object sender, EventArgs e)
{
string edu = education_news.Text;
using (SqlConnection _con = new SqlConnection(_Data.CS))
{
SqlCommand _Cmd = new SqlCommand("select * from tbl_brochures where type=@type", _con);
_Cmd.Parameters.AddWithValue("@type", edu);
_con.Open();
dl_brochures.DataSource = _Cmd.ExecuteReader();
dl_brochures.DataBind();
}
}
当我单击任何链接按钮时,该链接按钮的父 li 应该更改或将类添加到 li(this)。我也有疑问,但没有解决方案。
【问题讨论】: