N
nitin
I am adding controls to the UserControl dynamically and
then loading the UserControl Dynamically.But I am facing
problem with firing of click event of one of the buttons
within the UserControl.It does not fire.
If I do the same thing in a aspx page instead of a user
control then the event fires perfectly.
Adding of dynamic control in the User control is being
done as follows:
Page_Load
{
///
///
//
Table tbl = new Table();
tbl.Width = Unit.Percentage(100);
this.Controls.Add(tbl);
TableRow tr;
TableCell td;
btnSkipReg.ImageUrl = "../Images/btn_skip_reg.gif";
btnSkipReg.ID = "btnSkipReg";
btnSkipReg.Style.Add("cursor", "hand");
tr = new TableRow();
td = new TableCell();
td.Controls.Add(btnSkipReg);
tr.Cells.Add(td);
tbl.Rows.Add(tr);
///
///
///
}
private void InitializeComponent()
{
this.btnSkipReg.Click += new
System.Web.UI.ImageClickEventHandler(this.SkipReg_Click);
}
private void SkipRegistration_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
string redirectURL = "OrderConfUI.aspx";
Response.Redirect(redirectURL, true);
}
then loading the UserControl Dynamically.But I am facing
problem with firing of click event of one of the buttons
within the UserControl.It does not fire.
If I do the same thing in a aspx page instead of a user
control then the event fires perfectly.
Adding of dynamic control in the User control is being
done as follows:
Page_Load
{
///
///
//
Table tbl = new Table();
tbl.Width = Unit.Percentage(100);
this.Controls.Add(tbl);
TableRow tr;
TableCell td;
btnSkipReg.ImageUrl = "../Images/btn_skip_reg.gif";
btnSkipReg.ID = "btnSkipReg";
btnSkipReg.Style.Add("cursor", "hand");
tr = new TableRow();
td = new TableCell();
td.Controls.Add(btnSkipReg);
tr.Cells.Add(td);
tbl.Rows.Add(tr);
///
///
///
}
private void InitializeComponent()
{
this.btnSkipReg.Click += new
System.Web.UI.ImageClickEventHandler(this.SkipReg_Click);
}
private void SkipRegistration_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
string redirectURL = "OrderConfUI.aspx";
Response.Redirect(redirectURL, true);
}