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

onbuttonclick error after setting buttons to invisible

1 Answer 37 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Pat
Top achievements
Rank 1
Pat asked on 13 Apr 2010, 04:29 PM
Here's the scenario.

Our project uses a toolbar that is for the most part generic (ascx), however for specific modules that you enter some buttons are visible where other modules have different buttons that are visible.  To handle this we are building the toolbar declaratively with all module specific Buttons hidden.  Then in the Page_Load event we are setting the specific module buttons visibility to true.  If a submodule is entered (just another aspx page)  there's code that goes and hides some of the buttons that were set to visible true previously in the same Page_Load.

When the toolbar has a certain number or order of buttons removed (visibly they look correct) the server-side buttonclick event gets a nasty error.  We have been trying to figure out if this is an ordering issue (of when we are creating/showing/hiding buttons) or because we are creating the toolbar declaratively and then modifying the visibility programmatically (assumed unlikely).

Any ideas would be greatly appreciated.  Thank you!

1 Answer, 1 is accepted

Sort by
0
Accepted
Pat
Top achievements
Rank 1
answered on 13 Apr 2010, 05:34 PM
Odd... Where I am setting the toolbar buttons visibility to visible and then back to invisible (both in Page_Load), I needed to only set the module specific buttons to visible on postback and then not hide the buttons not shown in the submodules.

So the following is the order of what's happening

Declare all RADToolbarButtons in aspx

Then in Page_Load:

Show Module buttons

If (!isPostback)
    Hide Buttons restricted from submodule


It works!
Tags
ToolBar
Asked by
Pat
Top achievements
Rank 1
Answers by
Pat
Top achievements
Rank 1
Share this question
or