Welcome Guest Search | Active Topics | Sign In | Register

How to dynamically add controls to an item and identify a subgroup item Options
PaulG
Posted: Tuesday, May 3, 2011 8:52:14 AM
Rank: Newbie
Groups: Member

Joined: 5/3/2011
Posts: 6
HI,
Just evaluating your product(s). I have a tabstring with multiple levels to it.
Say it looks like this.
Top1
T1Sub1
T1Sub2
T1S2Sub1
T1Sub3
Top2
T2Sub1

I can find T1S2Sub1 at load and add an item of "Add". But I don't know how to add controls to that sub item.

What I want to do is Allow the sub tab to be build dynamically but also populate with the appropriate structure dynamically via the callback. I can get the callback triggered and it comes back with an idea of 0 when I click the "Add" tab but how to I get a control loaded for it at that time?

Basically I need to know how to dynamically load a Subgroup tab contents at run time.

Thanks
PaulG
Posted: Tuesday, May 3, 2011 9:26:16 AM
Rank: Newbie
Groups: Member

Joined: 5/3/2011
Posts: 6
Also the updatepanel does not seem to clearly identify the actually control that triggered the event. The callback to the server doesn't identify the triggering control and since The content of an item will vary with the tab I need to clearly know which tab the post back is for. It does do the postback when I click on the add which is very good but it naturally had to do postbacks as I traversed down to that tab.

So what I also need is the callback to clearly identify the source of the event.

Thanks
PaulG
Posted: Tuesday, May 3, 2011 9:43:44 AM
Rank: Newbie
Groups: Member

Joined: 5/3/2011
Posts: 6
I guess one of my questions is how do I programmatically assign a CustomItem?
eo_support
Posted: Tuesday, May 3, 2011 10:08:15 AM
Rank: Administration
Groups: Administration

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

The programmatically assign a CustomItem is very easy ---- you just set your TabItem's CustomItemID to the ID of your custom item. The difficult part is to keep the page control tree identical when the page posts back.

Whenver you use dynamic loading, you need to keep the page control tree identical when your page posts back in order for server events to function correctly. For example, if you have dynamically loaded a button, then you must ensure that button is being dynamically loaded again at the same place in the page control tree when the page posts back. That is necessary for the button to correctly trigger its Click event (otherwise the "event" won't find the "sender" button and it won't be triggered). This is a general ASP.NET rule and it has nothing to do with us.

I am not exactly sure what you mean by "updatepanel does not seem to clearly identify the actually control that triggered the event". However if you recreate the same control (with the same event handler) during post back, your own event handler would be properly called. For example, if you handle a button's Click event, then your click event handler will be called. Inside that handler you can use the "sender" argument to identify who triggered the event. It has nothing to do with the UpdatePanel.

As noted, this is an ASP.NET rule and has nothing to do with our controls ---- so you may want to try with standard button first. Once you get that working, you can replace the button with more complicated controls --- such as our CustomItem or try to associate it with our TabStrip. But you definitely want to get your control tree working first. That's the first step and if that part does not work, you will see all kind of strange problems.

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
PaulG
Posted: Tuesday, May 3, 2011 3:38:44 PM
Rank: Newbie
Groups: Member

Joined: 5/3/2011
Posts: 6
Thanks for the great info... I'm not home to test this out yet, but the server side event for the tab change I think identifies the sender as the tabcontrol I don't see where the actual tab item selected is identified. The index is set to 0 which is the 1st tab but of a subgroup and I don't know what subgroup is making the request. I'll test some more....

eo_support
Posted: Tuesday, May 3, 2011 3:45:03 PM
Rank: Administration
Groups: Administration

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

You would find out which control triggered the event from the first argument (sender) and which item triggered the event from the second argument (e.TabItem).

Thanks
PaulG
Posted: Tuesday, May 3, 2011 9:04:06 PM
Rank: Newbie
Groups: Member

Joined: 5/3/2011
Posts: 6
protected void CallbackPanel1_Execute(object sender, EO.Web.CallbackEventArgs e) {} is the server method for the callback event for loading the tab. sender == the call back panel and e doesn't say anything about the event. How would I know the exact item as index isn't specific across multiple subgroups? -- Thanks

Also I don't see the item posting then the tab is clicked? OnItemClick="tsMemberHome_Item_CLick" doesn't seem to fire on an item(tab) change? I trust within the callback set it would should be an ajax callback?

Thanks - Paul
eo_support
Posted: Tuesday, May 3, 2011 9:16:11 PM
Rank: Administration
Groups: Administration

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

You usually don't handle the CallbackPanel's Execute event. You handle whatever event you are supposed to handle as if the CallbackPanel did not exist. For example, if you were to handle a button's Click event before you use CallbackPanel, then you would still handle that button's click event after you use CallbackPanel. The only difference is you need to set the button as a trigger for the CallbackPanel. All event handling logic are the same with or without the CallbackPanel.

Thanks


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.