Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem to call bubble event of custom control.

Problem to call bubble event of custom control.

Scheduled Pinned Locked Moved ASP.NET
helpquestionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Imran Khan Pathan
    wrote on last edited by
    #1

    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.

    S 1 Reply Last reply
    0
    • I Imran Khan Pathan

      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.

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      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

      I 1 Reply Last reply
      0
      • S Sandeep Akhare

        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

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups