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

problem contextmenu on postback

2 Answers 81 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
PÄR-OSKAR HOLMGREN
Top achievements
Rank 1
PÄR-OSKAR HOLMGREN asked on 08 Jul 2008, 11:40 AM
Hi

I'm using a radtreeview on a page with a an radajaxmanager and from a contextmenu I'm trying to get a number of things to happen. My problem is this: when the treeview and contextmenu is originally created (before any postback) everything is fine and every event is executed as expected, but after postback the contextmenu appears somewhat strange, without the arrows to indicate submenus and it does not trigger any events.

I'm using a straight forward event - handler pattern on the treeview and the contextmenu :

(the class inherits radtreeview)

this.ContextMenuItemClick += new RadTreeViewContextMenuEventHandler(OrganizerTreeView_ContextMenuItemClick);

and a event handler:
protected void OrganizerTreeView_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)


I create the treeview and the contextmenu dynamically and I add the treeview anew on Page_PreRender if  IsPostBack is true.

Any ideas?

kind regards

/Per Holmgren

Inka Interactive

2 Answers, 1 is accepted

Sort by
0
PÄR-OSKAR HOLMGREN
Top achievements
Rank 1
answered on 08 Jul 2008, 01:16 PM
forget it, I solved it....

0
Erjan Gavalji
Telerik team
answered on 08 Jul 2008, 01:20 PM
Hi Per,

The problem most probably happens because of the addition of the RadTreeView (and, if separate control - the context menu too) to the Controls collection of the page in the late Page_PreRender stage.

Isn't it possible for you to move the creation of the controls and their addition to the Form.Controls collection of the page in an earlier stage of the page lifecycle, e.g. Init/Load?

Best regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
PÄR-OSKAR HOLMGREN
Top achievements
Rank 1
Answers by
PÄR-OSKAR HOLMGREN
Top achievements
Rank 1
Erjan Gavalji
Telerik team
Share this question
or