因此,我在此应用程序中尝试创建一个通知panel
,该通知将在其中显示一些数据(这些数据将由基于datasource
的{{1}}处理) object
。但是,其中一些通知的行为必须与其他通知有所不同。例如,错过的消息通知需要3 datarepeater
(忽略,响应,删除),而软件版本通知仅需要2(忽略,删除)。是否可以使用buttons
来执行此操作,还是应该为每种通知类型分别创建一个不同的datarepeater
和datasource
答案 0 :(得分:0)
我有一个数据转发器,并使用数据绑定事件(Button1_DataBinding)
,然后使用:
((GridViewRow)((Control)sender).Parent.Parent)
要转到gridview
行,然后可以展开该行以查看有问题的数据行:
((DataRowView)((GridViewRow)((Control)sender).Parent.Parent).DataItem)
[“ FIELD1”]
然后我可以根据绑定数据的任何字段或组合来设置按钮的visible属性,例如:
DataRowView DRV = (DataRowView)((GridViewRow)((Control)sender).Parent.Parent).DataItem;
if (DRV["FIELD1"].ToString().Trim() == "1234567")
((Button)sender).Visible = false;
else ((Button)sender).Visible = true;
请确保有一种更有效的方法,但是它可行