我的代码:
<dx:ASPxTreeList ID="treeList" runat = "server">
<Columns>
<dx:TreeListDataColumn Name="Edit" FieldName="EditColumn">
<DataCellTemplate>
<dx:ASPxButton ID="btnSample" runat="server" Text="SampleText">
</dx:ASPxButton>
</DataCellTemplate>
</dx:TreeListDataColumn>
</Columns>
</dx:ASPxTreeList>
我的目标是在btnSample
处将按钮Page_Load
显示为false。因此,我需要访问服务器端btnSample
事件的Page_Load
ID。我不知道如何访问服务器端ID
内按钮的TrreListDataColumn
。
答案 0 :(得分:2)
处理ASPxTreeList.HtmlDataCellPrepared事件:
protected void TreeList_HtmlDataCellPrepared(object sender, TreeListHtmlDataCellEventArgs e)
{
int empId = (int) e.GetValue("EmpID");
if ("EditColumn".Equals(e.Column.FieldName) && empId == 1)
{
ASPxButton button = (ASPxButton) treeList.FindDataCellTemplateControl(e.NodeKey, e.Column, "btnSample");
if (button != null)
button.Visible = false;
}
}