Welcome Guest Search | Active Topics | Sign In | Register

CallbackPanel + CallbackPanel Options
tommyleo
Posted: Friday, November 13, 2009 11:47:16 AM
Rank: Member
Groups: Member

Joined: 10/25/2009
Posts: 26
I'm doing a site like your "Demo Site", I like don't refresh the browser!! ;)

My problem is in a page like your "Demo Callback"...and now I try to explain!! (Sorry for my english)

We have a CallbackPanel for a TreeView and when is called the CallbackPanel Demo, we have a CallbackPanel in a Demo Page.

In a DemoPage for example I load server side a DropDownList whit a Databind().
The DropDown is triggered.

When I select the DropDown (MyDrop_SelectedIndexChanged), in the Page_Load my DropDown is clear and I loose the Event SelectedIndexChanged.

If I try to postback with a Button I don't loose the event (btnSubmit_Click), but the DropDown is clear.

The page is like your demo.ascx "Auto Disable Contents"

How I can resolve ?

Thx



eo_support
Posted: Friday, November 13, 2009 12:05:34 PM
Rank: Administration
Groups: Administration

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

The key is every time you dynamically load something, you will need to load it again when the page posts back. This is not general ASP.NET programming principle and it is not related to our control. You can see more details here:

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

Thanks!
tommyleo
Posted: Friday, November 13, 2009 12:34:17 PM
Rank: Member
Groups: Member

Joined: 10/25/2009
Posts: 26
Now I'm using your demo page "Auto Disable Contents"...

I add a DropDownList.
Code: HTML/ASPX
<asp:DropDownList id="MyDrop" runat="server" 
       onselectedindexchanged="MyDrop_SelectedIndexChanged">
</asp:DropDownList>


I add a Dropdown in a trigger of a CallbackPanel1
Code: HTML/ASPX
Triggers="{ControlID:btnSubmit;Parameter:},{ControlID:btnReset;Parameter:},{ControlID:MyDrop;Parameter:}"


Code: C#
private void Page_Load(object sender, System.EventArgs e)
{
            TextBox1.Style["width"] = "200px";
            if (!CallbackPanel1.IsCallbackByMe)
            {
                MyDrop.Items.Add("Uno");
                MyDrop.Items.Add("Due");
                MyDrop.Items.Add("Tre");
            }
}



When I select the DropDown in the Page_Load the DropDown is clear!! :(

I have test all with your demo, I see that you every time load again the dynamic control, but a dropdown is clear!! :(
eo_support
Posted: Friday, November 13, 2009 12:44:17 PM
Rank: Administration
Groups: Administration

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

Your code looks fine to us. Please create a full test page that demonstrates the problem so that we can try to run it here and see what's going on.

Thanks!
tommyleo
Posted: Friday, November 13, 2009 1:04:12 PM
Rank: Member
Groups: Member

Joined: 10/25/2009
Posts: 26
I resolve partially binding the dropdown in a Page_Init, partially because not work with the first element. Second e Third ok!!!

This is the demo.ascx located in : "EO.Web Controls 7.0 (2009)\Net20\Samples\CS\Demos\Callback\Features\Auto Disable Contents\Demo.ascx"

Code: HTML/ASPX
<%@ Control language="C#" AutoEventWireup="false" CodeFile="Demo.ascx.cs" Inherits="EO.Web.Demo.Demos.Callback.Features.Auto_Disable_Contents.Demo" %>
<%@ Register TagPrefix="eo" NameSpace="EO.Web" Assembly="EO.Web" %>
<p>EO.Web CallbackPanel can automatically disable its contents during callback. 
	Enter something and click "Submit" to see it in action.
</p>
<eo:callbackpanel id="CallbackPanel1" runat="server" LoadingHTML="Processing data, this may take a while..."
	Height="160px" 
    Triggers="{ControlID:btnSubmit;Parameter:},{ControlID:btnReset;Parameter:},{ControlID:MyDrop;Parameter:}" LoadingPanelID="panel1"
	AutoDisableContents="True">
	<asp:Panel id="panResult" Runat="server" Visible="False">
		<P>
			<asp:Label id="lblResult" Runat="server"></asp:Label></P>
		<asp:Button id="btnReset" Text="Try Again" Runat="server"></asp:Button>
	</asp:Panel>
	<asp:Panel id="panForm" Runat="server">
		<TABLE style="BORDER-COLLAPSE: collapse" borderColor="gainsboro" cellPadding="2" width="400"
			border="1">
			<TR>
				<TD colSpan="2">An Important Form - Can Not Be Submitted Twice</TD>
			</TR>
			<TR>
				<TD>Important Text:</TD>
				<TD>
					<asp:TextBox id="TextBox1" runat="server" MaxLength="100"></asp:TextBox></TD>
			</TR>
			<TR>
				<TD>Important Choice:</TD>
				<TD>
					<asp:DropDownList id="DropDownList1" runat="server">
						<asp:ListItem Value="Choice 1">Important Choice 1</asp:ListItem>
						<asp:ListItem Value="Choice 2">Important Choice 2</asp:ListItem>
					</asp:DropDownList></TD>
			</TR>
			<TR>
				<TD style="PADDING-LEFT: 10px; PADDING-TOP: 10px" colSpan="2">
					<asp:Button id="btnSubmit" Text="Submit" Runat="server" >
					</asp:Button></TD>
			</TR>
		</TABLE>
		<asp:DropDownList id="MyDrop" runat="server" 
            onselectedindexchanged="MyDrop_SelectedIndexChanged">
		</asp:DropDownList>
		
	</asp:Panel>
	<asp:Panel id="Panel1" Runat="server"></asp:Panel>
</eo:callbackpanel>


Code: C#
namespace EO.Web.Demo.Demos.Callback.Features.Auto_Disable_Contents
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// &lt;summary&gt;
	///		Summary description for Demo.
	/// &lt;/summary&gt;
	public partial class Demo : System.Web.UI.UserControl
	{
		private void Page_Load(object sender, System.EventArgs e)
		{
			TextBox1.Style["width"] = "200px";
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
            MyDrop.Items.Add("Uno");
            MyDrop.Items.Add("Due");
            MyDrop.Items.Add("Tre");
        }
		
		/// &lt;summary&gt;
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// &lt;/summary&gt;
		private void InitializeComponent()
		{
			this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
			this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion

		private void btnSubmit_Click(object sender, System.EventArgs e)
		{
			//Make the process to take a while
			System.Threading.Thread.Sleep(2000);

			panForm.Visible = false;
			panResult.Visible = true;
			lblResult.Text = string.Format("Your random confirmation number is {0}.", new Random().Next());
		}

		private void btnReset_Click(object sender, System.EventArgs e)
		{
			panResult.Visible = false;
			panForm.Visible = true;
		}
        
        protected void MyDrop_SelectedIndexChanged(object sender, EventArgs e)
        {
            TextBox1.Text = MyDrop.SelectedValue;
        }
}
}
eo_support
Posted: Friday, November 13, 2009 1:07:17 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
tommyleo wrote:
I resolve partially binding the dropdown in a Page_Init, partially because not work with the first element. Second e Third ok!!!

I am sorry but what exactly do you mean by that?
tommyleo
Posted: Friday, November 13, 2009 2:01:27 PM
Rank: Member
Groups: Member

Joined: 10/25/2009
Posts: 26
I'm very sorry for my english!!!

I mean that don't work......put the page in your demo project and try!!

Thx!!
eo_support
Posted: Friday, November 13, 2009 4:20:40 PM
Rank: Administration
Groups: Administration

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

Try your original code (The code that handles Page_Load, not Page_Init) in a separate page and it should work. The reason that it does not work in the sample is because the sample has ViewState disabled on this particular user control you are trying.

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.