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

Disabling toolbar buttons from the content pages

2 Answers 85 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Rishi
Top achievements
Rank 1
Rishi asked on 10 Mar 2010, 05:36 PM
 
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 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 11 Mar 2010, 09:16 AM

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.

0
Rishi
Top achievements
Rank 1
answered on 25 Mar 2010, 01:14 PM
Thanks Shinu.
Tags
ToolBar
Asked by
Rishi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Rishi
Top achievements
Rank 1
Share this question
or