ボタンがクリックされたかどうかをメソッドで確認したい
やってみたけどうまくいかない
コード:
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
//Here If (btnAddExperience_Click() is clicked)
{
GenerateControls();
}
GenerateControls1();
}
private void GenerateControls()
{
foreach (string i in NoOfControls)
{
VisaUserControl ctrl = (VisaUserControl)Page.LoadControl("VisaUserControl.ascx");
ctrl.ID = i;
this.rpt1.Controls.Add(ctrl);
rpt1.Controls.Add(new LiteralControl("<BR>"));
}
}
protected void btnAddVisa_Click(object sender, EventArgs e)
{
Button thisButton = (Button)sender;
List<string> temp = null;
var uc = (VisaUserControl)this.LoadControl(@"VisaUserControl.ascx");
string id = Guid.NewGuid().ToString();
uc.ID = id;
temp = NoOfControls;
temp.Add(id);
NoOfControls = temp;
rpt1.Controls.Add(uc);
rpt1.Controls.Add(new LiteralControl("<BR>"));
}
private void GenerateControls1()
{
foreach (string i in NoOfControls)
{
ExperienceUserControl ctrl = (ExperienceUserControl)Page.LoadControl("ExperienceUserControl.ascx");
ctrl.ID = i;
this.rpt1.Controls.Add(ctrl);
rpt2.Controls.Add(new LiteralControl("<BR>"));
}
}
protected void btnAddExperience_Click(object sender, EventArgs e)
{
List<string> temp = null;
var uc = (ExperienceUserControl)this.LoadControl(@"ExperienceUserControl.ascx");
string id = Guid.NewGuid().ToString();
uc.ID = id;
temp = NoOfControls;
temp.Add(id);
NoOfControls = temp;
rpt2.Controls.Add(uc);
rpt2.Controls.Add(new LiteralControl("<BR>"));
}
何か案は?前もって感謝します