Welcome Guest Search | Active Topics | Sign In | Register

Dialog Box Server Side Creation and Control Options
Jon Miller
Posted: Tuesday, May 5, 2009 9:43:44 AM
Rank: Member
Groups: Member

Joined: 4/23/2009
Posts: 23
I would like to create and control a Dialog from the server side so that I could have a reusable dialog on many pages. Please help me understand if this is possible using EO Dialog?

Thanks,
Jon
eo_support
Posted: Tuesday, May 5, 2009 10:01:26 AM
Rank: Administration
Groups: Administration

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

There are many ways to do this and there is nothing particular about the dialog. In another word, whatever scheme way you were using to create any other server control will work with the dialog. We will discuss a few options here so that you get the general idea.

One way to do is to place a dialog inside your master page. You can then reference the dialog in your content page either from code behind or from client side JavaScript.

Another way to do it is to place the dialog inside a user control and then load that user control when you need to.

A third way is to create a function to dynamically create a dialog, set all the properties with code, then add that dialog into your page. You would then call this function whenever you need the dialog.

In all cases, once the dialog is created or loaded, you must be able to get a reference to the dialog so that you will be able to use it (for example, to show it). If you use master page or user control, then you will need to code your master page or user control class so that it exposes the dialog. For example, if you have dialog1 directly in your page, then you can do this:

Code: C#
dialog1.InitialState = EO.Web.DialogState.Visible;


However, if you have user control userControl1 containing dialog1, you will NOT be able to do this:

Code: C#
userControl1.dialog1.InitialState = EO.Web.DialogState.Visible;


This is because dialog1 is a private member your user control. In order to access the dialog, you can add either expose the dialog directly through a property:

Code: C#
public EO.Web.Dialog TheDialog { get { return dialog1; } }


Or expose a method that does whatever you want to do on the dialog:

Code: C#
public void ShowDialog()
{
    dialog1.IntialState = EO.Web.DialogState.Visible;
}


These are added to the user control class so that you will be able to use the dialog from outside.

Hope this helps.

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.