動的な TemplateField を持つ RadGrid を持つユーザー コントロールがあります。それらは動的であるため、ITemplate から継承する独自のカスタム クラスを使用しています。以下のコード:
public class ApplicationHeaderTemplateItem : ITemplate
{
private string colName;
public ApplicationHeaderTemplateItem(string cName)
{
colName = cName;
}
public void InstantiateIn(Control container)
{
HtmlTable tb = new HtmlTable();
HtmlTableRow headerRow = new HtmlTableRow();
//Create the textbox to display the percentage
HtmlTableCell percentCell = new HtmlTableCell();
RadNumericTextBox txt = new RadNumericTextBox();
txt.ID = "txt" + colName;
txt.DataBinding += txt_DataBinding;
txt.AutoPostBack = true;
txt.TextChanged += txt_TextChanged;
percentCell.Controls.Add(txt);
headerRow.Cells.Add(percentCell);
--snip--
}
void txt_TextChanged(object sender, EventArgs e)
{
}
}
ご覧のとおり、テキストボックスに TextChanged イベントがあります。私の問題は、メソッドが ApplicationHeaderTemplateItem クラスのコンテキストで作成されるため、ユーザー コントロール内のどのコントロールにもアクセスできないことです。これを行う方法はありますか?