我有一堆需要类似处理的中继器。但是处理程序不仅需要访问作为命令主题的RepeaterItem,还需要访问包含Repeater的内容。
protected void SpecificRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
{
GenericHandler(e);
}
private void GenericHandler(RepeaterCommandEventArgs e)
{
RepeaterItem row = e.Item;
// Do things with the item.
Repeater table = e.<???>;
// Do things with the repeater.
}
基本上我在问<???>
中的内容。我怎样才能获得转发器?
答案 0 :(得分:1)
在ItemCommand中,源是Repeater本身,而不是按钮。因此,将源码转换回Repeater。
protected void SpecificRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
{
Repeater repeater = source as Repeater;
GenericHandler(e, repeater);
}
private void GenericHandler(RepeaterCommandEventArgs e, Repeater repeater)
{
}