Problem to call bubble event of custom control.
-
I am creating on custom control.I have problem to create bubble event of that control. Here is my code,In which I added one button control
protected override void RenderContents(HtmlTextWriter writer)
{
.....................
Button btn = new Button();
btn.Text=_updateTemplate.Text;
btn.ID = "ExelDataGrid_" + j.ToString() + i.ToString();
btn.CommandArgument = _rows[i - 1].ToString();
btn.CommandName = "update";btn.RenderControl(writer); ................... }
I have defined event
public event EventHandler Updating;
I am calling this method when buble event rise
protected virtual void OnUpdating(EventArgs e)
{
Updating(this, e);
}
protected override bool OnBubbleEvent(object source, EventArgs args)
{
OnUpdating(args);
return true;
}Now when I use this control on my web application,then OnUpdating event doesn't call on button click event. Can Anyone give me suggetion to solve this issue?
please don't forget to vote on the post that helped you.
-
I am creating on custom control.I have problem to create bubble event of that control. Here is my code,In which I added one button control
protected override void RenderContents(HtmlTextWriter writer)
{
.....................
Button btn = new Button();
btn.Text=_updateTemplate.Text;
btn.ID = "ExelDataGrid_" + j.ToString() + i.ToString();
btn.CommandArgument = _rows[i - 1].ToString();
btn.CommandName = "update";btn.RenderControl(writer); ................... }
I have defined event
public event EventHandler Updating;
I am calling this method when buble event rise
protected virtual void OnUpdating(EventArgs e)
{
Updating(this, e);
}
protected override bool OnBubbleEvent(object source, EventArgs args)
{
OnUpdating(args);
return true;
}Now when I use this control on my web application,then OnUpdating event doesn't call on button click event. Can Anyone give me suggetion to solve this issue?
please don't forget to vote on the post that helped you.
Where have you decalred event for Button Click ? I doubt you have done something wrong here
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog
-
Where have you decalred event for Button Click ? I doubt you have done something wrong here
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog
If I add button click event then also does not work. Here is my code
public void btn_Click(object sender, EventArgs e)
{
this.RaiseBubbleEvent(sender, e);//OnUpdating(e); // In this case also its not working. }
.........
btn.Click += new EventHandler(btn_Click);
btn.RenderControl(writer);
...........please don't forget to vote on the post that helped you.