|
在Grid的RowDataBound事件中设置 HyperLinkField 列 的Enabled属性,第一次绑定时好用,
第二次绑定grid后 HyperLinkField 列 的Enabled属性虽然设置了 但是在页面上显示的还是第一次绑定时的状态。
protected void gr_Main_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e)
{
ExtAspNet.HyperLinkField hlfDowm= gr_Main.FindColumn("hlDown") as ExtAspNet.HyperLinkField;
DataRowView row = e.DataItem as DataRowView;
if (row != null)
{
if (row["taskStatus"].ToString() == "0")//未提交
{
hlfDowm.Enabled = false;
}
else
{
hlfDowm.Enabled = true;
}
}
}
<ext:Grid ID="gr_Main" ShowHeader="False" runat="server" EnableCheckBoxSelect="false"
AllowSorting="true" SortDirection="ASC" SortColumn="colReport" PageSize="10" ShowBorder="true" AllowPaging="true" EnableMultiSelect="false"
EnableTextSelection="true" EnableRowClick="true" AjaxLoadingType="Mask"
IsDatabasePaging="false" AnchorValue="100% 100%"
DataKeyNames="solutionID,groupID,companyID" AutoScroll="true" >
<Columns>
<ext:TemplateField Width="30px">
<ItemTemplate>
<%# Container.DataItemIndex + 1%>
</ItemTemplate>
</ext:TemplateField>
<ext:HyperLinkField ColumnID="hlDown" HeaderText="报表下载" Width="60px" Text="下载" ToolTip="子公司最新报表"
DataTextFormatString="{0}" DataNavigateUrlFields="solutionID,groupID,companyID"
DataNavigateUrlFormatString="download.aspx?solutionID={0}&groupID={1}&companyID={2}"
DataNavigateUrlFieldsEncode="true" Target="_blank"
ExpandUnusedSpace="true" />
</Columns>
</ext:Grid>
|
|