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

Why can't I check a toolbar item on PageLoad

2 Answers 72 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Boone
Top achievements
Rank 2
Boone asked on 02 Dec 2009, 05:13 PM
protected void Page_Load(object sender, EventArgs e)
        {
             RadToolBarItem itemToCheck = toolbarNav.FindItemByValue("Trucks");
              itemToCheck.Checked = false;
        }

Checked is not there. Why isn't it there? Is there something else I should be using?

2 Answers, 1 is accepted

Sort by
0
Evan Hutnick
Top achievements
Rank 1
answered on 02 Dec 2009, 08:41 PM
Hey Boone,

Just looked into this and think I have a solution for you.  The first thing to note is that RadToolBarItem is just a generic item, so to speak, which is the base for any of the RadToolBar button types.  Since they all don't support being checked, the base type doesn't support it.

So, in a case like yours I'm gonna guess you might be using a RadToolBarButton, in which case you'd just do something like this:

        RadToolBarItem rtbi = xRadToolBar.FindItemByValue("Trucks");  
        (rtbi as RadToolBarButton).Checked = true

That'll give you access to the Checked property and you'll be nearly set.  I say nearly because it appears that the Checked functionality isn't turned on for the individual item unless you have CheckedOnClick="true" in the markup, in which case it'll reflect the Checked style.  Otherwise you can set Checked all day, but the functionality won't be there unless you've told the control in advance that it can be checked (CheckedOnClick="true").

-Evan
0
Boone
Top achievements
Rank 2
answered on 02 Dec 2009, 09:57 PM
Perfect, thanks.
Tags
ToolBar
Asked by
Boone
Top achievements
Rank 2
Answers by
Evan Hutnick
Top achievements
Rank 1
Boone
Top achievements
Rank 2
Share this question
or