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
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Charting" TagPrefix="cc1" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head runat="server"> |
| <title></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <asp:DropDownList ID="DropDownList1" runat="server" Width="89px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True"> |
| <asp:ListItem>1401</asp:ListItem> |
| <asp:ListItem>1406</asp:ListItem> |
| <asp:ListItem>1426</asp:ListItem> |
| <asp:ListItem>1059</asp:ListItem> |
| </asp:DropDownList> |
| <br /> |
| </div> |
| <telerik:RadChart ID="RadChart1" runat="server" Width="850px"> |
| <PlotArea> |
| <EmptySeriesMessage Visible="True"> |
| <Appearance Visible="True"> |
| </Appearance> |
| </EmptySeriesMessage> |
| </PlotArea> |
| </telerik:RadChart> |
| <br /> |
| <telerik:RadGrid ID="RadGrid1" runat="server"> |
| </telerik:RadGrid> |
| </form> |
| </body> |
| </html> |
| Imports System.IO |
| Imports System.Data.SqlClient |
| Imports System.Collections.Specialized |
| Imports System.Diagnostics |
| Imports System.Web.UI.HtmlControls |
| 'Imports Telerik.Windows.Controls.Charting |
| Imports System |
| Imports System.Data |
| Imports System.Configuration |
| Imports System.Collections |
| Imports System.Web |
| Imports System.Web.Security |
| Imports System.Web.UI |
| Imports System.Web.UI.WebControls |
| Imports System.Web.UI.WebControls.WebParts |
| Imports Telerik.Charting |
| Imports Telerik.Web.UI |
| Imports System.Data.Odbc |
| Imports System.Data.OleDb |
| Partial Class _Default |
| Inherits System.Web.UI.Page |
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| RadChart1.ChartTitle.Visible = False |
| RadChart1.Legend.Visible = False |
| If Not Page.IsPostBack Then |
| RadChart1.Visible = False |
| End If |
| End Sub |
| Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged |
| Dim i As Integer |
| Dim x As Integer |
| Dim totalacd As Integer |
| Dim str As StringString = String.Empty |
| Dim dte As StringString = String.Empty |
| Dim cmd As OdbcCommand |
| Dim cmd2 As OdbcCommand |
| Dim swhere As String |
| Dim swhere2 As String |
| Dim conn As New OdbcConnection |
| Dim inttotal As Integer |
| Dim average As Integer |
| conn.ConnectionString = ("DSN='';uid='';pwd=''") |
| conn.Open() |
| swhere = "select * from hsplit where row_date = TODAY - 1 OR row_date = TODAY AND split = " & DropDownList1.SelectedValue.ToString() & "" |
| swhere2 = "SELECT DISTINCT row_date, starttime FROM hsplit WHERE row_date = Today OR row_date = TODAY - 1 ORDER BY row_date DESC, starttime DESC" |
| cmd = New OdbcCommand(swhere, conn) |
| cmd2 = New OdbcCommand(swhere2, conn) |
| Dim dt As New DataSet1.DataTable1DataTable |
| Dim dt2 As New DataSet1.DataTable2DataTable |
| Dim dt3 As New DataSet1.DataTable3DataTable |
| Dim da As OdbcDataAdapter |
| Dim da2 As OdbcDataAdapter |
| dt.Clear() |
| dt2.Clear() |
| cmd.ExecuteNonQuery() |
| cmd2.ExecuteNonQuery() |
| da = New OdbcDataAdapter(cmd) |
| da2 = New OdbcDataAdapter(cmd2) |
| da.Fill(dt) |
| da2.Fill(dt2) |
| totalacd = 0 |
| inttotal = 0 |
| average = 0 |
| For x = 0 To 14 |
| For i = 0 To dt.Rows.Count() - 1 |
| Try |
| If dt2.Rows(x).Item("starttime") <> Nothing Then |
| Try |
| If dt.Rows(i).Item("starttime").ToString = dt2.Rows(x).Item("starttime").ToString Then |
| totalacdtotalacd = totalacd + dt.Rows(i).Item("acdcalls").ToString |
| inttotalinttotal = inttotal + 1 |
| End If |
| str = dt2.Rows(x).Item("starttime").ToString |
| dte = dt2.Rows(x).Item("row_date").ToString |
| Catch ex As Exception |
| average = 0 |
| str = dt2.Rows(x).Item("starttime").ToString |
| dte = dt2.Rows(x).Item("row_date").ToString |
| End Try |
| End If |
| Catch ex As Exception |
| average = 0 |
| End Try |
| Next |
| Dim newCustomersRow As DataSet1.DataTable3Row |
| newCustomersRow = dt3.NewDataTable3Row() |
| newCustomersRow("row_date") = dte |
| newCustomersRow("starttime") = str |
| Try |
| average = (totalacd / inttotal) |
| Catch ex As Exception |
| average = 0 |
| End Try |
| newCustomersRow("average") = average.ToString |
| newCustomersRow("total") = inttotal.ToString |
| dt3.Rows.Add(newCustomersRow) |
| average = 0 |
| totalacd = 0 |
| inttotal = 0 |
| Next |
| RadChart1.PlotArea.XAxis.DataLabelsColumn = dt3.starttimeColumn.ToString() |
| RadChart1.Series(0).Type = ChartSeriesType.Line |
| RadChart1.Series(1).Type = ChartSeriesType.Bar |
| RadChart1.Series(0).Visible = False |
| RadChart1.PlotArea.DataTable.Visible = True |
| RadChart1.ChartTitle.Visible = False |
| RadChart1.Legend.Visible = False |
| RadChart1.DataSource = dt3 |
| RadChart1.DataBind() |
| RadChart1.Visible = True |
| RadGrid1.DataSource = dt3 |
| RadGrid1.DataBind() |
| RadGrid1.Visible = True |
| conn.Close() |
| End Sub |
| End Class |
