Welcome Guest Search | Active Topics | Sign In | Register

Dialog, TabStrip, Menu slip Options
gilens
Posted: Thursday, March 6, 2008 5:14:35 PM
Rank: Newbie
Groups: Member

Joined: 3/6/2008
Posts: 7
Hi,

I have question regarding those 3 components that i have named in subject.
My request is something like this:
I need window (dialog) to open on client side, and when i open window i want to add one tab to tab strip that will be related with that newly opened window. Same will happen when i open next window. So i can have up to N windows, and each one will have it's own tab. That tab will bring focus to that window control. Content of that window will be some page (or control if it is better) from same application.

Now, when i described what i need to make with your components, my questions are:
- Is that possible to do from client side (with no post back) ?
- Can i save all opened windows states and tabs on accidental page refresh (refresh of page that will be holder for all those components) ?
- If i put Slide menu on same page where i create windows (and probably i will need callback component also for reloading that menu) can i create postback from some content page (page that is loaded in some dialog that exists on page) ?

I don't know if I explained correctly my problems (Think), but I'm trying to find solution, and i simply can't do it by my self. So, if you can please create my some small example if it is possible to do that ?

Thanks in advance...
eo_support
Posted: Thursday, March 6, 2008 5:56:45 PM
Rank: Administration
Groups: Administration

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

Thanks for posting in the forum. As for your questions:

1. There is no way for you to add a tab item into the tab strip without posting back. Two workaround exists:

a. Create all the tab items, but set them as invisible. You can then turn them visible with JavaScript. This only works if the number of tab items is known before hand;
b. Put the TabStrip inside a CallbackPanel and then update it on the server side through AJAX. This is much more flexible and can achieve similar visual result as perform it completely on the client side;

2. You can save all the states information with whatever mechanism. The dialog/tabstrip client side object provides all the necessary functions for you to retrieve the state information. Those state information are automatically saved through post back. If you wish to save those information beyond that (for example, save it even when user closes the browser window), you will need to save them by yourself.

3. You can interact with any objects that are in your page. It doesn't matter whether they are in master page, content page or user control or whatever code unit.

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

Thanks
gilens
Posted: Thursday, March 6, 2008 6:06:51 PM
Rank: Newbie
Groups: Member

Joined: 3/6/2008
Posts: 7
eo_support wrote:
Hi,

Thanks for posting in the forum. As for your questions:

wow...thanks for really quick answer, I'm thrilled :D

eo_support wrote:
1. There is no way for you to add a tab item into the tab strip without posting back. Two workaround exists:
b. Put the TabStrip inside a CallbackPanel and then update it on the server side through AJAX. This is much more flexible and can achieve similar visual result as perform it completely on the client side;

this sounds great, i think it can solve my problem, but still, i need to add dialog control from JavaScript, how can i then combine callbackPanel and this Dialog adding from JS (Dialog and Tab) ?

eo_support wrote:
2. You can save all the states information with whatever mechanism. The dialog/tabstrip client side object provides all the necessary functions for you to retrieve the state information. Those state information are automatically saved through post back. If you wish to save those information beyond that (for example, save it even when user closes the browser window), you will need to save them by yourself.

I think when i tried this, and created 3 dialogs from client side, and hit F5, all 3 were closed ?
Do i need to change some property, or something like that ?

eo_support wrote:
3. You can interact with any objects that are in your page. It doesn't matter whether they are in master page, content page or user control or whatever code unit.

but this object is inside Dialog, i don't know if it is treated differently then regular UserControl ?
To explain more precisely...i have one page with link that will open Dialog with custom UserControl that has button on itself. when i click that button i want to update CallbackPanel. Is that possible, and can you write some example code please ?
eo_support
Posted: Thursday, March 6, 2008 6:26:37 PM
Rank: Administration
Groups: Administration

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

You can use CallbackPanel to add any controls, including the dialog control. You can trigger a callback either with trigger or JavaScript. Trigger is quite straight forward, using JavaScript requiring you to call eo_Callback JavaScript function, please see the documentation for more detail.

One common mistake when using CallbackPanel and dynamically creating control is to assume the dynamically created control will be automatically saved in view state. This is false. The following two posts discussed similar issues:

http://www.essentialobjects.com/Forum/default.aspx?g=posts&t=1056
http://www.essentialobjects.com/Forum/default.aspx?g=posts&t=347

As for the state information, you will need to have your own mechanism to take care of refresh situation. The control provides you functions to get/set the state information. The control automatically saves state in view state, which only works when the page posts back, not refresh.

Unless you use ContentUrl, the dialog content is not in a different page, which means it acts more like a Panel control, so you can put whatever inside.

Hope this clears up.

Thanks
gilens
Posted: Friday, March 7, 2008 6:42:37 PM
Rank: Newbie
Groups: Member

Joined: 3/6/2008
Posts: 7
Hi again...

I have again question about slide menu. How can i assign custom user control to slide menu dynamically ?
So, i have user control named uc1.ascx, and I want to put it as new menu item in slide menu. How can i do that ?
I noticed that i need to create custom control (from example of slide menu design - Outlook 2003) and to assign some control as that custom control, and in menu item, i need to change CustomItemID to that item ID...but how can i do that dynamically when i have bunch of controls (maybe with same user control file) ?

Thanks ahead,
Gile
eo_support
Posted: Friday, March 7, 2008 7:06:03 PM
Rank: Administration
Groups: Administration

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

I am not exactly sure what you mean.....There is nothing special about it. You just dynamically create them. For example, the following code dynamically creates a CustomItem:

Code: C#
//Create a CustomItem and add it as a child control of
//"Panel1", this is the same as placing a CustomItem control
//inside "Panel1" at design time
EO.Web.CustomItem customItem = new EO.Web.CustomItem();
customItem.ID = "CustomItem1";
Panel1.Controls.Add(customItem);

//Place your user control inside the CustomItem
UserControl yourUserControl = LoadYourUserControl();
customItem.Controls.Add(yourUserControl);

//Set the first child menu item's CustomItemID as "CustomItem1"
SlideMenu.Items[0].SubMenu.Items[0].CustomItemID = customItem.ID;


You basically duplicates whatever you would be doing when declaring it statically. Make sure you create them in Page_Init instead of Page_Load, and be careful of the view state issue we mentioned in our previous reply.

Thanks
gilens
Posted: Friday, March 7, 2008 7:18:16 PM
Rank: Newbie
Groups: Member

Joined: 3/6/2008
Posts: 7
Hi,

Let me try to explain in different way...
I will have one custom user class that would be stored in session, and i will have bunch of different user controls. Each one of those controls will have smaller version of that control. And that "smaller version" of control should be loaded in Slide menu.
Now, I'm trying to make Dialog that will have some of those user controls loaded in itself, and on that control i will have one button for "custom minimize" action (when i will do this action). When i click on that button I need to close that dialog, and to add specific user control to slide menu. So, my idea was to add that user control info in my custom class, and to call Callback of panel that contains slide menu, and on callback, i will recreate complete slide menu.
Do you have any different suggestion how to do that job ?

Thanks ahead,
Gile

P.S.
I can't create it statically because user can click on "custom minimize" button, and he may not click...it is up to him, and i can't load 100 controls, and try to hold them all in slide menu, and enable and disable the ones i need ;)
eo_support
Posted: Friday, March 7, 2008 7:32:43 PM
Rank: Administration
Groups: Administration

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

We are not asking you to load 100 controls. What we are trying to show you is to how to load one control. Once you can load one, you can load as many as you like based on whatever logic you'd like. So it is my understanding that there is no real difference between what you are asking and what we have showed to you.

The only tricky part, which we have mentioned again and again, is the view state issue --- which is an issue you will face with whatever dynamically control loading. It has nothing to do with our controls. It all comes down to the way ASP.NET works and you must play by the rules set by ASP.NET. For this I would recommend you to take a look of our demo project. Our demo project dynamically loads user controls (each demo is a user control) via callback, which is a situation very similar to yours.

The best way for you to approach this might be not using our controls at the very beginning at all. Dynamic control loading itself is a complex thing, thus I would recommend you get that part going before diving into our control. Try use simple link buttons to replace the slide menu. Use standard panels to replace CustomItem. That way you will have a good idea about how dynamic loading works. Once you get that going you can start to plug in our controls.

Thanks
gilens
Posted: Friday, March 7, 2008 7:43:26 PM
Rank: Newbie
Groups: Member

Joined: 3/6/2008
Posts: 7
Ok, let me try to explain this like...I know how to dynamically load control in page, that is not a problem...i just think that i can't explain you correctly what i need, and then of course, you can't answer to my badly asked question :)

Ok, i will try something like this...saving state is not problem...i will save state in some way (as my application logic request), BUT my question is:
If i need to add item to menu slide form within some custom user control loaded in dialog. Is it better to write that info somewhere in DB, and call Callback to reload all items (with custom controls) within slide menu, or all items that were loaded in page_init will be automatically saved in page state, and i only need to add new item to slide menu ?

Really sorry for such lousy explanations, i don't know how your controls work (in base) so, that is probably the reason for asking this questions !!
eo_support
Posted: Friday, March 7, 2008 7:51:05 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
gilens wrote:
If i need to add item to menu slide form within some custom user control loaded in dialog. Is it better to write that info somewhere in DB, and call Callback to reload all items (with custom controls) within slide menu


This is an option.

gilens wrote:
or all items that were loaded in page_init will be automatically saved in page state, and i only need to add new item to slide menu ?


This is another option. The menu will save all items you dynamically added. The problem is if you want to dynamically add controls (not menu items), those controls will not be saved.

If you have a back end database it might be much easier for you to go option 1. It's a lot easier than option 2 because you do not have to worry about state information.

Hope this helps.
gilens
Posted: Friday, March 7, 2008 8:00:44 PM
Rank: Newbie
Groups: Member

Joined: 3/6/2008
Posts: 7
Great, this was very helpfully...thanks a lot
gilens
Posted: Sunday, March 9, 2008 9:16:41 AM
Rank: Newbie
Groups: Member

Joined: 3/6/2008
Posts: 7
Hi again with same topic :)

Probably I'm wrong somewhere, but i can't find the way to solve it :(

This is my aspx page:
Code: HTML/ASPX
<eo:CallbackPanel ID="partCallbackPanel" runat="server" LoadingHTML="Loading..."
	OnExecute="partCallbackPanel_Execute">
	<eo:SlideMenu ID="partSlideMenu" runat="server" Width="280px" EnableScrolling="true"
		ExpandEmptyPane="true" SingleExpand="true">
	</eo:SlideMenu>
</eo:CallbackPanel>


this is code behind:
Code: C#
protected void partCallbackPanel_Execute(object sender, EO.Web.CallbackEventArgs e)
{
	partSlideMenu.Items.Clear();
	EO.Web.MenuItem item = new EO.Web.MenuItem();

	EO.Web.CustomItem ci = new EO.Web.CustomItem();
	ci.ID = "ci1";

	Control cc = LoadControl("Controls\\partControl.ascx");

	ci.Controls.Add(cc);

	item.CustomItemID = "ci1";
	partSlideMenu.Items.Add(item);
}


and this is partControl.ascx
Code: HTML/ASPX
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="partControl.ascx.cs" Inherits="Controls.partControl" %>
<table width="100%">
	<tr>
		<td>
			<asp:Label ID="label1" runat="server" Text="This should be custom control displayed in slide menu !!" />
		</td>
	</tr>
</table>


and simply it does not work...can you please tel me where i made mistake ?

Thanks ahead,
Gile
eo_support
Posted: Sunday, March 9, 2008 9:37:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hum....Should have thought about this before. I don't think CustomItem works with CallbackPanel. Controls inside CustomItem works with CallbackPanel, but the item itself does not. So what you can do is to have the slide menu and CustomItem statically declared in your .aspx page, and use a CallbackPanel to update contents (loading your user control) inside the the CustomItem (which means the CallbackPanel is placed inside the CustomItem). If you indeed have multiple CustomItem that needs to be dynamically loaded, then you probably should not use CallbackPanel when you need to load them.

Another notes is, you should not assign a CustomItem to a top level slide menu items. Technically there is nothing wrong with it but in reality it has no use. The reason is because for slide menu, it's the sub menu that expands/collapses, and the top items are used to trigger such expand/collapse. So generally whatever "custom" stuff is placed in the sub menu (just like the Outlook style slide menu, the Calendar is placed in a CustomItem of a child menu item).

You should also rely on other events other than partCallbackPanel_Execute if you wish your modification to be saved because partCallbackPanel_Execute occurs at the late stage of the rendering cycle and is too late for anything get saved. An easy solution for this is to use a trigger control and handle that trigger controls' event. If you can not use trigger control, handle Page_Load and inside your Page_Load use

Code: C#
if (partCallbackPanel.IsCallbackByMe)
{
    //do whatever you were doing inside your Execute event handler
}


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.