Hi,
I programmaticall y create a/some buttons:
private TableCell GenerateButtonI nCell(XmlNode NodeItem)
{
Button ChoosePlanButto n = new Button();
ChoosePlanButto n.CommandArgume nt = NodeItem.OuterX ml;
ChoosePlanButto n.UseSubmitBeha vior = false;
ChoosePlanButto n.ToolTip = "Request this plan";
ChoosePlanButto n.Text = String.Concat(" Apply");
TableCell InnerTableCell = new TableCell();
InnerTableCell. Controls.Add(Ch oosePlanButton) ;
return InnerTableCell;
}
I attach it/them all to the same handler:
void ChoosePlanButto n_Click(object sender, EventArgs e)
{
//PERSIST THE CHOSEN PLANS ATTRIBUTES TO VIEWSTATE
Button temp = (Button)sender;
ViewState.Add(" ChosenPlan", temp.CommandArg ument);
}
then I try to register them pre page render thus:
override protected void OnInit(EventArg s e)
{
if (ChoosePlanButt on != null)
{ ChoosePlanButto n.Click += new
EventHandler(Ch oosePlanButton_ Click); }
base.OnInit(e);
}
but obviously I cant reference the ChoosePlanButto n instance outside the
method.
How do accomplish this?
Many thanks.
I programmaticall y create a/some buttons:
private TableCell GenerateButtonI nCell(XmlNode NodeItem)
{
Button ChoosePlanButto n = new Button();
ChoosePlanButto n.CommandArgume nt = NodeItem.OuterX ml;
ChoosePlanButto n.UseSubmitBeha vior = false;
ChoosePlanButto n.ToolTip = "Request this plan";
ChoosePlanButto n.Text = String.Concat(" Apply");
TableCell InnerTableCell = new TableCell();
InnerTableCell. Controls.Add(Ch oosePlanButton) ;
return InnerTableCell;
}
I attach it/them all to the same handler:
void ChoosePlanButto n_Click(object sender, EventArgs e)
{
//PERSIST THE CHOSEN PLANS ATTRIBUTES TO VIEWSTATE
Button temp = (Button)sender;
ViewState.Add(" ChosenPlan", temp.CommandArg ument);
}
then I try to register them pre page render thus:
override protected void OnInit(EventArg s e)
{
if (ChoosePlanButt on != null)
{ ChoosePlanButto n.Click += new
EventHandler(Ch oosePlanButton_ Click); }
base.OnInit(e);
}
but obviously I cant reference the ChoosePlanButto n instance outside the
method.
How do accomplish this?
Many thanks.
Comment