通过读取标识字段,设置LinkButton是否可用。
因为后台审核的,不能用JS那种,只能读数据表的标识字段来判断。
<asp:DataList ID="DataList2" runat="server" RepeatColumns="4" OnItemCommand="DataList1_ItemCommand">
<ItemTemplate>
<asp:LinkButton ID="lkbImg" runat="server">
<img src='/Student/UpSmallPhoto/<%# Eval("Photo_Path")%>' style="border-width:0px" width="133px" height="100px"/>
</asp:LinkButton>
<asp:LinkButton ID="pass" CommandName="workPass" style="text-decoration:none;color:#ff0000;" runat="server" Text="审核通过" CommandArgument =<%# Eval("Work_ID")%>/>
</div>
</ItemTemplate>
</asp:DataList>
//PageLoad下:
SqlConnection mycon = mydata.sqlcon;
mycon.Open();
string sqlstr = "select * from Stu_Work order by Work_PostDate DESC";
SqlDataAdapter MyAdapter = new SqlDataAdapter(sqlstr, mycon);
DataSet ds = new DataSet();
MyAdapter.Fill(ds, "Stu_Work");
DataRowView rowview = ds.Tables["Stu_Work"].DefaultView[0];
string is_Pass = rowview["Pass"].ToString();
if (is_Pass == "1")
{
this.pass.Enabled = false;
}