Welcome Guest Search | Active Topics | Sign In | Register

Change Label of Dialog at runtime Options
Ronald
Posted: Thursday, October 1, 2009 11:54:01 AM
Rank: Member
Groups: Member

Joined: 8/21/2008
Posts: 24
Hi!

I want to create a page with a modeless dialog, after the user click on a button. Additional I need to change a Text attribute of a Label, when the dialog will be shown.

Background:
I show a grid, where the user can check or uncheck some elements and when the user clicks the button "continue", the dialog with a progressbar and the label should be shown. The label should give the user information of his selections made before.

For this reason, I add a CallbackPanel with the button as a trigger. In the "ClientSideAfterExecute" I call the script with the modeless show of the dialog and in the "CallbackPanel1_Execute" I change the Text of the Label.
Code: JavaScript
function OnCallbackExecute ()
    {
        eo_GetObject("DownDialog").show(false);
    }


and

Code: C#
protected void CallbackPanel1_Execute(object sender, EO.Web.CallbackEventArgs e)
        {
            if (e.Parameter.ToString() == "Start")
            {
                LDownquestion.Text = "Are you sure?";
            }
            else if (e.Parameter.ToString() == "TaskDone")
            {
            }
        }


When I put the dialog outside of the CallbackPanel, the debugger shows at runtime, that the text attribute was changed, but in the browser, the label.text is the same, as on design-time.
Code: HTML/ASPX
<eo:CallbackPanel ID="CallbackPanel1" runat="server" Height="1px" Width="1px" 
                Triggers="{ControlID:BDownload;Parameter:Start}" 
                ClientSideBeforeExecute="" ClientSideAfterExecute="OnCallbackExecute" 
                onexecute="CallbackPanel1_Execute">
            </eo:CallbackPanel>
            <eo:Dialog ID="DownDialog" runat="server" BackColor="White" 
            ...
            


When I put the dialog inside of the CallbackPanel, eo_GetObject won't be able to find the dialog any more.

Code: HTML/ASPX
<eo:CallbackPanel ID="CallbackPanel1" runat="server" Height="1px" Width="1px" 
                Triggers="{ControlID:BDownload;Parameter:Start}" 
                ClientSideBeforeExecute="" ClientSideAfterExecute="OnCallbackExecute" 
                onexecute="CallbackPanel1_Execute">
                        <eo:Dialog ID="DownDialog" runat="server" BackColor="White" 
                        ...
                        eo:CallbackPanel>


Is my attempt wrong? Is there a easier way to come to the same solution?

Many thanks
Ronald
eo_support
Posted: Thursday, October 1, 2009 12:41:07 PM
Rank: Administration
Groups: Administration

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

The dialog should be inside eo:CallbackPanel. I am not sure why eo_GetObject can not find the dialog though. You can try to use the dialog's ClientID and see if that works:

Code: JavaScript
eo_GetObject("&lt;%=DownDialog.ClientID%&gt;").show(false);


The basic rule for CallbackPanel is whatever you want to update must be inside the CallbackPanel. So if you wish to update a Lable inside the dialog, you can also put the CallbackPanel inside the dialog only around the Label you wish to update.

Thanks!
Ronald
Posted: Friday, October 2, 2009 3:49:31 AM
Rank: Member
Groups: Member

Joined: 8/21/2008
Posts: 24
Hi,

I fixed the problem Angel

But I don't really understand why...

As described above, I use this script to show the modeless dialog:
Code: JavaScript
function OnCallbackExecute ()
    {
        alert (eo_GetObject("DownDialog"));  // Only for debugging
        eo_GetObject("DownDialog").show(false);
    }


Calling this script from "ClientSideBeforeExecute" of the CallbackPanel, the object found by eo_GetObject is valid, but the show-function does nothing.

Calling this script from "ClientSideAfterExecute" the object is null.

Calling it from "ClientSideAfterUpdate" everything works fine.

Any idea?


Many thanks
Ronald
eo_support
Posted: Friday, October 2, 2009 7:51:35 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
That makes perfect sense. The CallbackPanel works by destroy everything inside it and then reload them. All objects are destroyed after ClientSideBeforeExecute and recreated before ClientSideAfterUpdate. So when you call it inside ClientSideBeforeExecute, you can get the object, but the object is destroyed shortly after, so whatever you call on it really doesn't matter. The object is not recreated until shortly before ClientSideAfterUpdate. That's why inside ClientSideAfterUpdate you can get the object again.
Ronald
Posted: Friday, October 2, 2009 9:03:29 AM
Rank: Member
Groups: Member

Joined: 8/21/2008
Posts: 24
You are right!

Thank you!


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.