dynamically creation of radtoolbar in radtab

2 posts, 0 answers
  1. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 30 Mar 2011 Link to this post

    hi,
    not able to add click event in radtoolbar.
    i want to fire"RadToolBar_ButtonClick" fire this event on radtoolbar button click.

    <telerik:RadTabStrip ID="rtsActionMenuToolBar" runat="server" MultiPageID="RadMultiPage1"
                                  SelectedIndex="0" Style="padding-left: 5px;" ShowBaseLine="true">
                              </telerik:RadTabStrip>
                               <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Height="100px" SelectedIndex="0"
                                  CssClass="MultipageWrapper">
                                  </telerik:RadMultiPage>

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List<ActionMenuToolBarBE> lstActionMenuToolBarBE = new ActionMenuToolBarDomain().SelectActionMenuToolBar(null, null);
     
                List<ActionMenuToolBarBE> lstActionMenuToolBarBEParent = lstActionMenuToolBarBE.FindAll(delegate(ActionMenuToolBarBE obj) { return obj.ParentToolBarID == 0; });
                foreach (ActionMenuToolBarBE obj in lstActionMenuToolBarBEParent)
                {
                    RadTab rootTab = new RadTab();
                    rootTab.Text = obj.ToolBarName;
                    rootTab.Value = obj.ToolBarID.ToString();
                    rtsActionMenuToolBar.Tabs.Add(rootTab);
     
                    RadToolBar objRadToolBar = new RadToolBar();
                    objRadToolBar.AutoPostBack = true;
                    objRadToolBar.CausesValidation = false;
                    objRadToolBar.ButtonClick += new RadToolBarEventHandler(RadToolBar_ButtonClick);
     
                    List<ActionMenuToolBarBE> lstActionMenuToolBarBEChild = lstActionMenuToolBarBE.FindAll(delegate(ActionMenuToolBarBE objchild) { return objchild.ParentToolBarID == obj.ToolBarID; });
                    foreach (ActionMenuToolBarBE objChild in lstActionMenuToolBarBEChild)
                    {
                        RadToolBarButton tbb = new RadToolBarButton();
                        tbb.Text = objChild.ToolBarName;
                        objRadToolBar.Items.Add(tbb);
                    }
     
                    RadPageView pageView = new RadPageView();
                    pageView.ID = obj.ToolBarName;
                    pageView.Controls.Add(objRadToolBar);
                    RadMultiPage1.PageViews.Add(pageView);
                }
            }
        }
     
        protected void RadToolBar_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            string s1 = e.Item.Value;
        }


    Regards,
    Jayesh Goyani
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 30 Mar 2011 Link to this post

    Hi

    i found the solution.

    remove ispostback condition and write this code in page's  Oninit() event.

    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top