Disabling toolbar buttons from the content pages

3 posts, 1 answers
  1. Rishi
    Rishi avatar
    42 posts
    Member since:
    Feb 2010

    Posted 10 Mar 2010 Link to this post

     
    Hi,

    I had to add a tool bar to the website so what i did was have a toolbar user control added the required toolbar with its items and added this user control to the master page.    Now i want to enable or diable certain items/toolbar buttons in the toolbar depending on the content page I am on
    is it possible to do so??

    Thanks,
    Harisha
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Mar 2010 Link to this post

    Hello Harisha,

    You could try the following code snippet in order to access the RadToolBar and disable the item.

    C#:

     
        protected void Button1_Click(object sender, EventArgs e)  
        {  
            // Check for condition  
            UserControl uc = (UserControl)this.Page.Master.FindControl("WebUserControl1"); // Access the user control  
            RadToolBar toolbar = (RadToolBar) uc.FindControl("RadToolBar1"); // Get access to RadToolBar control  
            toolbar.FindItemByText("Button 0").Enabled = false// Get the item and set disabled  
        } 

    -Shinu.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rishi
    Rishi avatar
    42 posts
    Member since:
    Feb 2010

    Posted 25 Mar 2010 Link to this post

    Thanks Shinu.
Back to Top