Welcome Guest Search | Active Topics | Sign In | Register

Enable callbackpanel2 from callbackpanel1 Options
Ces@rPil
Posted: Friday, March 15, 2013 6:24:30 PM
Rank: Newbie
Groups: Member

Joined: 1/3/2013
Posts: 6
Hi,
I have 2 callbackpanel, the other one is disabled by default on initial page load. When I am done on callbackpanel1, I display an eodialog control that when it is closed it should disable the panel1 and enable the panel2 but I cannot make this thing works. Is this doable?

Thank you.
eo_support
Posted: Friday, March 15, 2013 6:41:35 PM
Rank: Administration
Groups: Administration

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

I do not see any reason why it is not doable. However a CallbackPanel only AJAX updates controls inside that CallbackPanel. So if you plan to AJAX update anything from CallbackPanel1, even a second CallbackPanel2, that control has to be inside CallbackPanel1. One way to get around of this is to use GroupName property. You can have two CallbackPanel controls updates at the same time by setting their GroupName to the same value.

Thanks!
Ces@rPil
Posted: Saturday, March 16, 2013 7:34:52 PM
Rank: Newbie
Groups: Member

Joined: 1/3/2013
Posts: 6
Hi,
I tried your solution but it didn't work. I set the group name of both panel to cp1 but nothing happened. If I set the update mode to conditional and once I trigger to enable the panel 2, both panels loadinghtml runs indefinitely.
All I want is disable panel 1 after I'm done with it and enable panel 2. Please note that panel 2 is not inside panel 1.

Thanks.

eo_support
Posted: Saturday, March 16, 2013 7:41:49 PM
Rank: Administration
Groups: Administration

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

We tested the following code and it works fine:

Code: HTML/ASPX
<asp:Button runat="server" ID="Button1" Text="Test" onclick="Button1_Click" />
<eo:CallbackPanel runat="server" ID="cp1" GroupName="cp1" 
    Triggers="{ControlID:Button1;Parameter:}">
    <asp:Label runat="server" ID="Label1"></asp:Label>
</eo:CallbackPanel>
<eo:CallbackPanel runat="server" ID="cp2" GroupName="cp1">
    <asp:Label runat="server" ID="Label2"></asp:Label>
</eo:CallbackPanel>


Code: C#
protected void Button1_Click(object sender, EventArgs e)
{
    Label1.Text = DateTime.Now.ToString();
    Label2.Text = DateTime.Now.ToString();
}


When button "Test" is clicked, both Labels are updated.

Thanks!
Ces@rPil
Posted: Saturday, March 16, 2013 10:23:10 PM
Rank: Newbie
Groups: Member

Joined: 1/3/2013
Posts: 6
Hi,

Yes your code works but it is different from what i need to accomplish. Please check below code.
Code: HTML/ASPX
<script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    <title>Untitled Page</title>
   <script type="text/javascript">
       $(function() {
           $('._click').on('click', function() {
               eo_GetObject('<%= Dialog1.ClientID %>').show();
           });
           $('._close').on('click', function() {
               eo_GetObject('<%= Dialog1.ClientID %>').close();
           });           
       });
   </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <eo:CallbackPanel ID="cp1" runat="server" Width="100%" LoadingHTML="&lt;div style=&quot;padding-right:50px&quot;&gt;
	&lt;img src=&quot;Logos/ajax-loader.gif&quot; /&gt;&lt;label style=&quot;FONT-SIZE: 8pt; FONT-FAMILY: Verdana&quot;&gt; Processing Request... Please Wait.&lt;/label&gt;&lt;/div&gt;"
            Height="139px" Triggers="{ControlID:btn1;Parameter:BTN1},{ControlID:Dialog1;Parameter:D1}" 
            onexecute="cp1_Execute" GroupName="c1" UpdateMode="Conditional">
            <asp:Label ID="lbl1" runat="server" Text="Sample: "></asp:Label><br />
            <asp:TextBox ID="txt1" runat="server" Width="309px"></asp:TextBox><br />
            <asp:Button ID="btn1" runat="server" Text="Click Me" CssClass="_click" />
                </eo:CallbackPanel><hr /> 
             <eo:CallbackPanel ID="cp2" runat="server" Width="100%" LoadingHTML="&lt;div style=&quot;padding-right:50px&quot;&gt;
	&lt;img src=&quot;Logos/ajax-loader.gif&quot; /&gt;&lt;label style=&quot;FONT-SIZE: 8pt; FONT-FAMILY: Verdana&quot;&gt; Processing Request... Please Wait.&lt;/label&gt;&lt;/div&gt;"
            Height="100px" onexecute="cp2_Execute" 
                Triggers="{ControlID:btn2;Parameter:BTN2}"
            GroupName="c1" UpdateMode="Conditional">
      
                <table style="width: 100%;">
                    <tr>
                        <td>
                            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txt2" runat="server" Width="412px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Button ID="btn2" runat="server" Text="Button 2" />
                        </td>
                    </tr>
                    
                </table>   
            </eo:CallbackPanel>
            <hr />
   
    </div>
    <eo:Dialog ID="Dialog1" runat="server" AcceptButtonPostBack="True" 
        BackColor="White" CloseButtonUrl="00020312" ControlSkinID="None" 
        HeaderHtml="Dialog Title" Height="216px" Width="320px" 
        AcceptButton="btnClose" style="text-align: center">
        <FooterTemplate>
            <asp:Button ID="btnClose" runat="server" Text="Close ME" CssClass="_close" 
                onclick="btnClose_Click" />
        </FooterTemplate>
        <HeaderStyleActive CssText="background-image:url('00020311');color:black;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-bottom:5px;padding-left:8px;padding-right:3px;padding-top:0px;height:18px;" />
        <BorderImages BottomBorder="00020305" BottomLeftCorner="00020304" 
            BottomRightCorner="00020306" LeftBorder="00020303" RightBorder="00020307" 
            TopBorder="00020310" TopLeftCorner="00020301" TopLeftCornerBottom="00020302" 
            TopRightCorner="00020309" TopRightCornerBottom="00020308" />
        <FooterStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma" />
        <ContentStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma" />
    </eo:Dialog>
    </form>
</body>
</html>


Code: C#
protected void Page_Load(object sender, EventArgs e)
        {
            if (!cp1.IsCallbackByMe)
            {
                cp2.Enabled = false;
            }
        }      

        protected void btnClose_Click(object sender, EventArgs e)
        {
            cp1.Enabled = false;
            cp2.Enabled = true;
        }

        protected void cp2_Execute(object sender, EO.Web.CallbackEventArgs e)
        {
            if (e.Parameter == "BTN2")
            {
                txt2.Text = "button 2 clicked!";
            }
        }

        protected void cp1_Execute(object sender, EO.Web.CallbackEventArgs e)
        {

        }


Once I click the button from the dialog, the loadingHTML runs indefinitely.

Also, I have to use JQuery to close the dialog because btnClose from the dialog does not close the dialog even if assigned as the dialog's acceptbutton.
eo_support
Posted: Saturday, March 16, 2013 10:58:45 PM
Rank: Administration
Groups: Administration

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

We do not review or debug our customers' code. We only explain to you how the product works. In this case we have given you a working sample. So you can compare your code with ours and see if you can find out why yours is not working.

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.