This is a migrated thread and some comments may be shown as answers.

RaiseBubbleEvent Doesn't Seem To Raise Event

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul Martissa
Top achievements
Rank 1
Paul Martissa asked on 29 Jan 2009, 07:57 PM

Hello, I am using the RadGrid from the Prometheus release, version 2007.3.1425.20 in a .Net 2.0 application. We are trying to raise an event up from a user control to it's parent container. The set up is a RadGrid control is contained within a user control placed in a parent aspx page that uses a master page.  The user control's parent aspx page's OnBubbleEvent never gets control. The code used for this follows. Any help would be appreciated. All I can think of is that the RadGrid has an OnBubbleEvent and returns false so it never bubbles, but I am not sure.

The following code is called form the linkbutton and contains the RaiseBubbleEvent:

    protected void getSelectedItems(object sender, EventArgs e)
    {
        //iterate through selection and add selected items to collection
        foreach (GridDataItem item in grdBlocklist.MasterTableView.Items)
        {
            if (((CheckBox)item.FindControl("chkDisable")).Checked)
            {
                _items.Add(new BlockList(0, item["BillTo"].Text, item["ShipTo"].Text, item["SoldTo"].Text,
                    null, null, DateTime.Now.ToString(), item["BrandDesc"].Text, _type));
            }
        }

        //...then raise event to parent
        RaiseBubbleEvent(sender, e);
    }

The linkbutton that start this train was added by this code:

    protected void grdBlocklist_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridHeaderItem)
        {
            GridHeaderItem header = (GridHeaderItem)e.Item;
            LinkButton btn = new LinkButton();

            btn.Text = (_editMode ? "[block]" : "[unblock]");

            btn.Command += new CommandEventHandler(getSelectedItems);
            header["disable"].Controls.AddAt(0, btn);
        }
    }

However the parent container's following code block is not hit:

    protected void OnBubbleEvent(object sender, EventArgs e)
    {
        try
        {
            foreach (BlockList item in this.ctlBlocklistTelerik1.Items)
            {
                //check if this is a block or unblock
                if (this.ctlBlocklistTelerik1.EditMode)
                    item.Block();
                else
                    item.UnBlock();
            }

            //rebuild list
            rebindBlocklist();
        }
        catch (Exception oEX)
        {
            throw;
        }
    }

Thanks

1 Answer, 1 is accepted

Sort by
0
Paul Martissa
Top achievements
Rank 1
answered on 29 Jan 2009, 08:31 PM
My bad, the OnBubbleEvent signature was incorrect. It has to be used as an overriden method.

protected

override bool OnBubbleEvent(object sender, EventArgs e)

 

 

 

 

 

Tags
Grid
Asked by
Paul Martissa
Top achievements
Rank 1
Answers by
Paul Martissa
Top achievements
Rank 1
Share this question
or