我有一个DataList控件调用DataList1和另一DataList控件调用内DataList1 DataList3的。现在我有一个内部datalist3的形象,我必须设置在运行时的能见度。
我已经写pageLoad的下面的代码:
//search for records in DataList3
if (((DataList)(DataList1.Items[0].FindControl("DataList3"))).Items.Count <= 0)
{
//if no records found than display Image20 instead of DataList3
((DataList)(DataList1.Items[0].FindControl("DataList3"))).Visible = false;
((System.Web.UI.WebControls.Image)(DataList1.Items[0].FindControl("Image40"))).Visible = true;
}
else
{
//if records found than display DtaList3 instead of Image20
((DataList)(DataList1.Items[0].FindControl("DataList3"))).Visible = true;
((System.Web.UI.WebControls.Image)(DataList1.Items[0].FindControl("Image40"))).Visible = false;
}
但我没有找到任何需要的结果。形象和DataList显示在这两个案件。
任何指导,将是有益的。
我的整个pageLoad的
{C} datalist1约束力
| patelKhyati:Mahendra.p25 | |更新后的代码
<asp:DataList ID="DataList1" runat="server" DataKeyField="sr"
DataSourceID="SqlDataSource9" Width="100%" onload="DataList1_Load">
<itemtemplate>
<table class="style472">
style="border: medium solid #669999; font-family: Verdana; font-size: 10pt; height: 281px;"
width="100%">
<tr>
<td bgcolor="#669999" class="style697" colspan="4" style="vertical-align: top">
<span class="style696">
<table class="style472">
<tr>
<td class="style793">
</td>
<td class="style790">
<asp:Label ID="UserFromLabel" runat="server" style="font-weight: 700"
Text='<%# Eval("UserFrom") %>' />
{体C3}