Welcome Guest Search | Active Topics | Sign In | Register

I only get half-a-feature when RaisesServerEvent="True" Options
Juan Roman Escamilla
Posted: Wednesday, December 19, 2007 6:56:30 PM
Rank: Member
Groups: Member

Joined: 12/17/2007
Posts: 10
When using a SlideMenu, I need to know when an item has been clicked in the server to do some stuff. My problem is, when I use RaisesServerEvent="True" either at the top level or per item, the slide menu will stop expanding and collapsing on its own. It's like if I want to know that the event occurred is up to me to also handle collapsing/expanding.

As a workaround, I started using e.NavigationItem.Selected = !e.NavigationItem.Selected, but I just realized that's not good enough, so I am now using e.NavigationItem.Expanded = !e.NavigationItem.Expanded and that seems to do the trick.

But still, is this the way this should be done? It seems like trapping the event should be a feature trade-off. What's the right way do this since I cannot find any reference on it in the documentation?

As a reference, attached is my server-side code:

Code: C#
private const string PowerStripSelectionDictionaryKey = "PowerStripSelectionDictionary";

/// <summary>
/// Handles the ItemClick event of the slideMenu control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EO.Web.NavigationItemEventArgs"/> instance containing the event data.</param>
protected void OnSlideMenuItemClick(object sender, EO.Web.NavigationItemEventArgs e)
{
    if (null == e)
        throw new ArgumentNullException("e");

    if (null != e.NavigationItem)
    {
        // Update Web Part Manager ...
        WebPartManager wpm = WebPartManager.GetCurrentWebPartManager(base.Page);
        if (null != wpm)
        {
            if (string.IsNullOrEmpty(e.NavigationItem.Value))
            {
                // Set Web Part Manager to Browse mode (default)
                wpm.DisplayMode = WebPartManager.BrowseDisplayMode;
            }
            else
            {
                FieldInfo fieldInfo = typeof(WebPartManager).GetField(e.NavigationItem.Value, BindingFlags.GetField | BindingFlags.Public | BindingFlags.Static);
                if (null == fieldInfo)
                {
                    // Sepecified value does not map to a Display Mode within the WebPartManager, so set back to Browse mode (default)
                    wpm.DisplayMode = WebPartManager.BrowseDisplayMode;
                    return;
                }

                wpm.DisplayMode = (WebPartDisplayMode) fieldInfo.GetValue(wpm);
            }
        }

        // Update slide menu selections
        e.NavigationItem.Selected = !e.NavigationItem.Selected;
        Dictionary<int, bool> selectionData = (base.ViewState[PowerStripSelectionDictionaryKey] as Dictionary<int, bool>);
        if (null == selectionData)
            selectionData = new Dictionary<int, bool>();

        if (selectionData.ContainsKey(e.NavigationItem.Index))
        {
            selectionData[e.NavigationItem.Index] = e.NavigationItem.Selected;
        }
        else
        {
            selectionData.Add(e.NavigationItem.Index, e.NavigationItem.Selected);
        }

        // Update view state
        base.ViewState[PowerStripSelectionDictionaryKey] = selectionData;
    }
}
eo_support
Posted: Wednesday, December 19, 2007 7:11:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Juan,

Slide menu shouldn't have any problem when you set a child item's RaisesServerEvent to true, because regardless raising server event or not, clicking a child item does not expand/collapse the slide menu.

Top level items in the slide menu are different. As you have noticed, they will not automatically expand/collpase if their RaisesServerEvent is set to true. In that case you would use Expanded to manually expand them (just as you have found).

Thus the typical usage of a slide menu is to have child items to raises server event, but have top level items to merely serving as category expander, thus not raising server event. This is also the default behavior if you set RaisesServerEvent to true on the slide menu, but not on individual menu item.

Thanks
Juan Roman Escamilla
Posted: Thursday, December 20, 2007 3:51:13 PM
Rank: Member
Groups: Member

Joined: 12/17/2007
Posts: 10
There are so many reasons why the previous solution is not ok. First of all let me tell you that the reason why we bought these controls is that we needed the server-side notification. But this solution is not working for us anymore:

1) Our Slide Menu is inside a Splitter Panel, and as mentioned on another post, the Splitter lacks of Java Script functions to show or hide a panel so we are using server side events to do so. Now to try to mimic the expected behavior of the Slide Menu I have tried to put both controls on a Callback Panel and that ends in a Scripting Error (just put any slide menu inside a splitter-panel and put everything into a callback to see the behavior). So after almost all week in this, the result is that the site does Post-Backs when I show the splitter, when I hide it, and everytime I click on a top group item.

2) I cannot find a way to keep the animation when doing postbacks. They stop working when having the RaiseServerEvent="True". I have tried doing my server-side event using Page-Methods, Client-Side Scripting, and many more with no success.

We need that gliding effect and less postbacks. Otherwise we're back to square one of what he had with the AjaxToolkit.

Any Ideas?
eo_support
Posted: Thursday, December 20, 2007 4:39:02 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Juan,

I understand frustration, but please keep in mind that while we do our best to satisify your need, we also need to balance what you would like to have and what other people would like to have. So sometimes we are able to give you a solution that would 100% meet your need, and unfortunately there are times we can not, simply because if we change our product to fit your need, many of our other clients who want our product the other way won’t be happy at all.

Have that said, we are all for it if your requirment would not conflict with others. For example, you have suggested splitter client side interface, which we happily put in our list and is looking forward to implement it soon.

As for keep animation when doing postback, the simple answer is no. It's not workable and you do not want to do it. No page/control ever does that and there is a reason for it. There are other ways to trigger postback after a delay, or trigger postback on the background (for instance, our CallbackPanel), but a normal post back is always an immediate postback.

Thanks
Juan Roman Escamilla
Posted: Thursday, December 20, 2007 4:43:28 PM
Rank: Member
Groups: Member

Joined: 12/17/2007
Posts: 10
It is, what it is...


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.