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

Toolbar Events not bubbling

2 Answers 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed Bassin
Top achievements
Rank 1
Ed Bassin asked on 24 Jul 2008, 07:27 PM
Hello,

I am trying to make my grid have a toolbar like the example:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/ToolBar/Examples/ApplicationScenarios/GridCommandItem/DefaultCS.aspx?product=toolbar

When I click the toolbar buttons, the event bubbling doesn't seem to happen.

Here is a simplified example I put together which is not working for me:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CommandItemTest.aspx.cs" 
    Inherits="CommandItemTest" %> 
 
<!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>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
            <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="needData"
                <MasterTableView CommandItemDisplay="Top" AllowAutomaticInserts="true"
                    <CommandItemTemplate> 
                        <telerik:RadToolBar runat="server"
                            <Items> 
                                <telerik:RadToolBarButton Text="Add new" CommandName="InitInsert" ImageUrl="images/Add_User.png" 
                                    Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'
                                </telerik:RadToolBarButton> 
                                <telerik:RadToolBarButton Text="Add this Customer" CommandName="PerformInsert" ImageUrl="images/Add_User.png" 
                                    Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'
                                </telerik:RadToolBarButton> 
                            </Items> 
                        </telerik:RadToolBar> 
                    </CommandItemTemplate> 
                </MasterTableView> 
            </telerik:RadGrid> 
    </form> 
</body> 
</html> 
 


using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
 
public partial class CommandItemTest : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
 
    protected void needData(object sender, EventArgs e) { 
        DataTable dt = new DataTable(); 
        dt.Columns.Add("first"); 
        dt.Columns.Add("second"); 
        DataRow row = dt.NewRow(); 
        row["first"] = "abc"; 
        row["second"] = "def"; 
        dt.Rows.Add(row); 
        RadGrid1.DataSource = dt
    } 


Thanks in advance







2 Answers, 1 is accepted

Sort by
0
Vladimir
Top achievements
Rank 1
answered on 24 Jul 2008, 07:36 PM
Hi Ed,

Please set ID for RadToolBar and let me know about the result.

Vlad
0
Ed Bassin
Top achievements
Rank 1
answered on 24 Jul 2008, 07:40 PM
Nope, that did not fix it, but setting the AutoPostBack property of the toolbar to "true" made it work.  For some reason, this property was not set in the online demo.
Tags
Grid
Asked by
Ed Bassin
Top achievements
Rank 1
Answers by
Vladimir
Top achievements
Rank 1
Ed Bassin
Top achievements
Rank 1
Share this question
or