It looks as if eventargs._props[1] = 0; works in FireFox4 but does not work in IE8. Any help would be appreciated. Thanks!
Hello jdymond,
If you’re using autopostback in you project this will not work.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
We are using it as a Navagation menu so it does not make sens to have to PostBack when a Group or Root item is clicked.
Hello jdymond ,
Were you able to reproduce the issue with the sample I provided?
In your project do you initialize the postbacks for the child elements with the AutoPostBackFlags or are you setting them manually on the client side events?
I am unable to run it because it is using Framework 4.0 and is in C# but I looked at the code and control properties and understand it 100%. I modified my project and it canceled the PostBack. However, we will need to trigger a PostBack for the children. How can I achive this on the Server as we have code behind needed for any of the child item click events? It simply does not need PostBacks when Expanding or Colapsing the menus only the children. Thanks!
I’ve been looking into this and came up with the following solution.
In the Item click event of the WebExplorerBar make a check if the selected item has any children. If it doesn’t then it’s not the header but a child item from the categories. Then just do a manual postback for it . Here's an example:
if (!sender.get_selectedItem().hasChildren()) {
__doPostBack('WebExplorerBar1\',\'\')', 0);
}
I hope this solution will work for your scenario. If you need further assistance don’t hesitate to ask.
Also note that when you fire off anything using the ItemClick event, it seems to force a PostBack regardless of the __doPostBack('WebExplorerBar1\',\'\')', 0); and overrides the ItemExpanding event which cancels the PostBack when clicking on the header eventArgs._props[1] = 0;
The whole concept is simple. A page has 2 WebExploerBars on it. If you click the Header of any of the WebExplorerBars, a PostBack should NOT occur. Once expanded, If you click on any child item, a PostBack should occur. Also, if another WebExplorerBar is already expanded, it should be colapsed.
I have asked our engineering staff to examine the issue with the misbehavior of the ItemClick events.
I will send you more information regarding this through your support ticket with number: CAS-69118-7VWNYM.
Ok Thanks for your help. I have pieced everything together and have figured this out flawlessly. Here are the steps...
1. Set the AutoPostBackFlags to ItemClick "Off" and ItemSelected "Off"
2. Add 4 ClientSide Events. ItemExpanding. ItemCollapsing, ItemExpanded, and ItemSelected.
Note: ItemExpanding and ItemCollapsing will call the same function.
3. The ItemExpanding and ItemCollapsing function will have the following JavaScript which will cancel the PostBack on a Header/Group Click.
eventArgs._props[1] = 0;
4. The ItemSelected function will have the following JavaScript which will cause a PostBack on a Child Item Click.
var id = sender._id;
if (!sender.get_selectedItem().hasChildren()) { __doPostBack(id, 0); }
Note: You will add any ServerSide code from the Child Click in the WebExplorerBar's ItemSelected Handler.
5. The ItemExpanded ClientSide Event you can add any code to collapse anoy other open menus and the like.
Hope this helps everyone else out! :)
I tried out what you described and indeed it fires a postback regardless if you set all the Auto Post back flags to false. This seem like a misbehavior and I will report it to the development team.
In the meantime try using the ItemSelected server side event instead of the ItemClicked. It doesn’t trigger an auto postback.
As for your previous question you can just get the sender’s id like this:
And do the post back for the child items like this:
__doPostBack(id, 0);
If you have further questions don't hesitate to ask.