我有一个动态生成的单选按钮,其中匿名委托声明为
在
private void SetFieldDependency(DocumentSimpleFieldDetailDto obj, Table table, RadioButton ctrlExtended, Panel pnl)
{
if (this.ListOfDependentFields != null)
{
var lstRelatedField = this.TemplateCompiledDto.LstSimpleFields.Where(a => a.FkDocumentTemplateSectionId == obj.FkDocumentTemplateSectionId
&& !a.IsGridField && a.FieldGroup == obj.FieldGroup);
var objDependencyList = this.ListOfDependentFields.FindAll(h => lstRelatedField.Any(k => h.ParentFieldId == k.TemplateSimpleFieldDetailId));
if (objDependencyList != null && objDependencyList.Count > 0)
{
ctrlExtended.AutoPostBack = true;
ctrlExtended.CheckedChanged += (sender, e) =>
{
foreach (var fieldDependency in objDependencyList.Where(h => h.ChildFieldId != null))
{
var tr = table.FindControl(fieldDependency.ChildFieldId.ToString()) as TableRow;
if (tr != null)
{
if (fieldDependency.ParentFieldId == obj.TemplateSimpleFieldDetailId)
{
tr.Visible = true;
}
else
{
tr.Visible = !tr.Visible;
}
}
}
SetGridFieldDependency(obj, pnl, objDependencyList);
};
}
}
}
现在在一些按钮提交事件上我必须调用这个事件。如果radiobutton
CheckChanged
它像ctrlExtended_Changed(object sender, EventArgs e)
我可以轻松调用,但如何调用绑定的匿名委托方法?
我也在使用 Asp.net