Welcome Guest Search | Active Topics | Sign In | Register

Dynamic bound slide menu, first item posts client regardless of RaisesServerEvent Options
DMZ1984
Posted: Friday, February 17, 2012 11:31:10 AM
Rank: Member
Groups: Member

Joined: 10/21/2011
Posts: 13
Hello,

I'm working on a dynamically bound slide menu in which all subs (1:1 parent to sub) are a common customitem.

Within the customitem there are several dynamically bound controls which I re-bind upon _ItemClick of the parent in the slide.

The execution looks something like this:
Onload: Bind Slide Menu (Create Parents) > Slide ItemDataBound: Create/add Sub .CustomItemID = "CustomControlName" (Create Subs for each Parent with the same CustomControl)

The initial slide menu control's RaisesServerEvent is true, even in the LookItems I add in another redundant RaisesServerEvent just to be sure in the item level.

The problem I'm experiencing is that my first item (generated on bind, like all others) will only post client side. All other subsequent parents post and hit the server side _ItemClick event.

Analyzing the autogenerated html I noticed that all items which server posted properly shared a .ashx?id=#### while the one which only went client (regardless of properties) had a unique id#.

Here's the code for the slidemenu:
Code: HTML/ASPX
<eo:SlideMenu ID="ProjectSlider" runat="server" ControlSkinID="None" 
        SlidePaneHeight="231" Width="450px" onitemclick="ProjectSlider_ItemClick" 
        onitemdatabound="ProjectSlider_ItemDataBound" RaisesServerEvent="True">
        <LookItems>
            <eo:MenuItem RaisesServerEvent="True" Height="22" ItemID="_TopLevelItem" LeftIcon-ExpandedUrl="00020006" 
                LeftIcon-Url="00020007" 
                NormalStyle-CssText="background-color:White;border-bottom-color:#dddddd;border-bottom-style:solid;border-bottom-width:1px;color:#000099;" 
                SelectedStyle-CssText="background-color:#CDE6F7;color:#000099;">
            </eo:MenuItem>
        </LookItems>

        <TopGroup Style-CssText="font-size: 12px; cursor: hand; font-family: arial">
        </TopGroup>
    </eo:SlideMenu>


Thank you for the assistance,
-DZ
DMZ1984
Posted: Friday, February 17, 2012 12:26:22 PM
Rank: Member
Groups: Member

Joined: 10/21/2011
Posts: 13
I believe I may have resolved the issue.

What I realized just now was that the parent works client side always and the property affects the subs.

Yet the customitem is loaded with tons of items which caused divs etc to overlap. So when the tall sub of the first record was opened it overlapped the other parents. So clicking any parents under the first one just actually was running the first records sub which overlapped them.

Still testing it out but it seems this is the case in my scenario.
eo_support
Posted: Friday, February 17, 2012 12:32:57 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Thanks for the update. That does make sense. You can try to increase the slide menu's SlidePaneHeight and see if that helps in avoiding overlapping and proving your theory.
DMZ1984
Posted: Friday, February 17, 2012 12:38:57 PM
Rank: Member
Groups: Member

Joined: 10/21/2011
Posts: 13
Would it be not good practice to re-load my customitem upon expansion/slide of the parent? I feel like I need to since all parent's share the same exact customitem control. That way there's only one instance of it and it refreshes itself on demand with a parent slide/expansion.

I feel like there's no way of capturing that event (parents expand) in the code behind is there? I'm trying to not get too fancy with with async data as its supposed to be a quick inhouse app.
eo_support
Posted: Friday, February 17, 2012 1:07:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

It really depends on whether you need them to be reloaded or not. It's also a balance between having multiple CustomItem (thus multiple of your controls inside the CustomItem) and having to refresh them on every load. Which way is better really depends on your application so we would not advise towards or against either way. Both methods are reasonable to us.

You should not try to rely on the parent items' ItemClick event. For a slide menu, the parent item's purpose is to expand/collapse the sub items. This does not work well if the page is being posted back at the same time.

Thanks!
DMZ1984
Posted: Friday, February 17, 2012 2:59:14 PM
Rank: Member
Groups: Member

Joined: 10/21/2011
Posts: 13
Is it possible to rebind my customitem of the sub in which the parent was expanded on the fly?
I started to venture down the call back panel route with little luck as well where on the codebehind event I'd perform my refresh of the sub control.

Any suggestions? I'm guessing using the slidemenu wasn't the best of starting points for this.
eo_support
Posted: Friday, February 17, 2012 3:27:29 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can do that with CallbackPanel. That's the right way to do it. In order to use CallbackPanel you have to understand when and how to trigger it (in your case would be when the parent item is clicked), as well as what to do when the CallbackPanel is triggered (in your case would be updating the contents of your CustomItem). I would recommend you to work on the CallbackPanel alone first to get a full understanding of this process first. Once you know the CallbackPanel well, you then can decide on how to use it best on your project.

Thanks
DMZ1984
Posted: Monday, February 20, 2012 12:01:15 PM
Rank: Member
Groups: Member

Joined: 10/21/2011
Posts: 13
Thank you for the reply, that was the exact path which I'm on. The only difficulty I'm now having is with injection of a parameter for the Callback.execute(param). Seems using eventInfo.getItem() is the menu item scope and not the navigationItem so pulling any useful attribute isn't really available. In the JS function I'm still working ID'ing which of the parents was clicked as suggested above. Any sure shot proven methods?
DMZ1984
Posted: Monday, February 20, 2012 1:02:45 PM
Rank: Member
Groups: Member

Joined: 10/21/2011
Posts: 13
All resolved, thank you for the assistance. My SP was malformed so that once the data was bound to create the menu the value was always '' which made debugging the JS value return/param fun.
eo_support
Posted: Monday, February 20, 2012 6:11:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Cool. Glad that everything is working for you now. Thanks for the update!


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.