A
Amelyan
I *finally* narrowed down my problem to my custom web control. If I hookup
event inside dynamically created custom web control, it doesn't get fired.
However, event gets fired for any other standard dynamically created web
control. the code below works in VS 2003 (radio_CheckedChanged get
invoked), but it doesn't work in VS 2005.
Is there something extra I need to override or add in VS2005 to make event
fire?
namespace ClassLibrary1
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : WebControl
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
public string Text
{
get
{
String s = (String)ViewState["Text"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Text"] = value;
}
}
protected override void RenderContents(HtmlTextWriter output)
{
base.RenderContents(output);
}
protected override void CreateChildControls()
{
Controls.Add(GetRadioButton());
}
public Control GetRadioButton()
{
TableCell cell = new TableCell();
RadioButton radio = new RadioButton();
radio.ID = "a_12311";
radio.CheckedChanged += new EventHandler(radio_CheckedChanged);
radio.Text = "Suka!!!!!";
radio.GroupName = "sadlfjklsakdjfas";
radio.Checked = false;
cell.Controls.Add(radio);
Table tbl = new Table();
tbl.Rows[tbl.Rows.Add(new TableRow())].Cells.Add(cell);
tbl.BorderWidth = 10;
return tbl;
}
void radio_CheckedChanged(object sender, EventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}
}
}
event inside dynamically created custom web control, it doesn't get fired.
However, event gets fired for any other standard dynamically created web
control. the code below works in VS 2003 (radio_CheckedChanged get
invoked), but it doesn't work in VS 2005.
Is there something extra I need to override or add in VS2005 to make event
fire?
namespace ClassLibrary1
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : WebControl
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
public string Text
{
get
{
String s = (String)ViewState["Text"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Text"] = value;
}
}
protected override void RenderContents(HtmlTextWriter output)
{
base.RenderContents(output);
}
protected override void CreateChildControls()
{
Controls.Add(GetRadioButton());
}
public Control GetRadioButton()
{
TableCell cell = new TableCell();
RadioButton radio = new RadioButton();
radio.ID = "a_12311";
radio.CheckedChanged += new EventHandler(radio_CheckedChanged);
radio.Text = "Suka!!!!!";
radio.GroupName = "sadlfjklsakdjfas";
radio.Checked = false;
cell.Controls.Add(radio);
Table tbl = new Table();
tbl.Rows[tbl.Rows.Add(new TableRow())].Cells.Add(cell);
tbl.BorderWidth = 10;
return tbl;
}
void radio_CheckedChanged(object sender, EventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}
}
}