我正在尝试获取此表中的图像按钮,以通过C#中的代码隐藏起来(以便在执行操作后将其隐藏)。
<asp:UpdatePanel runat="server" ID="upEmpListContainer" UpdateMode="Conditional"
OnPreRender="upEmpListContainer_PreRender" OnInit="upEmpListContainer_Oninit">
<ContentTemplate>
<asp:ListView ID="lvEmpList" OnItemDataBound="lvEmpList_ItemDataBound" OnDataBound="lvEmpList_DataBound"
OnLayoutCreated="lvEmpList_LayoutCreated" runat="server" OnPreRender="lvEmpList_PreRender">
<LayoutTemplate>
<table class="formData_tb" cellspacing="0" style="margin: 0px; width: 100%;">
<tr>
<th colspan="9" class="currentManagerLabel" style="text-align: center">
<span>Currently displaying
<asp:Label ID="lblManager" runat="server" />
employees </span>
<asp:ImageButton ID="DrillUp" AlternateText="Move up in reporting heirarchy" runat="server"
CommandName="DrillDown" ImageUrl="~/images/icoDoubleArrowUp.gif" OnCommand="butDrillDown_Click" />
</th>
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>
我只是似乎无法从其ID访问它。我已经尝试过,DrillUp.Enabled = false;
但是Visual Studio表示无法解析符号“ DrillUp”。
您的imagebutton在布局模板中,您不能直接访问它。
试试这个
ImageButton b = (ImageButton)lvEmpList.FindControl("DrillUp");
b.Visible = false;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句