Welcome Guest Search | Active Topics | Sign In | Register

Tabstrip and Load on Demand, controls not working Options
Sarge
Posted: Thursday, September 20, 2007 4:16:23 PM

Rank: Member
Groups: Member

Joined: 9/14/2007
Posts: 21
I'm pretty sure I don't have a good grasp on what is going on here. I want to use the tab strip to do async load on demand. I'm testing it with a simple set of pages at first to see if it will work for our very complicated CMS.
I started with the demo source code and broke the different tabs into ascx user controls like you guys did. After figuring out I had to register CallbackPanel1_Execute with
override protected void OnInit(EventArgs e)
{
this.CallbackPanel1.Execute += new EO.Web.CallbackEventHandler(this.CallbackPanel1_Execute);
base.OnInit(e);
}
I eventually got it working . . . kinda.
My next step was to put some controls in the tabs instead of just plain text, problem is, when the control posts back (say a button click un-hiding a label for instance) Nothing gets rendered, the button click does not seem to run the correct function.
It appears as though that tabs ascx file is not being loaded properly on postback and I'm still a little fuzzy as to how all that works.
Again, my test is almost identical to your demo code, I'll post some of it below.

Code: HTML/ASPX
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>

<script type="text/javascript">
function SwitchTab(e, info)
{
	eo_Callback('<%=CallbackPanel1.ClientID%>', info.getItem().getIndex().toString());
}
</script>

<eo:TabStrip runat="server" id="TabStrip1" ControlSkinID="None" ClientSideOnItemClick="SwitchTab">
	<DesignOptions BackColor="239, 235, 222"></DesignOptions>
	<TopGroup>
		<Items>
			<eo:TabItem Text-Html="Pages"></eo:TabItem>
			<eo:TabItem Text-Html="Files"></eo:TabItem>
		</Items>
	</TopGroup>
	<LookItems>
		. . .
	</LookItems>
</eo:TabStrip>

<div style="padding: 10px 10px 10px 10px">
	<eo:CallbackPanel runat="server" id="CallbackPanel1" Width="100%" Height="200px" LoadingHTML="Loading...">
	</eo:CallbackPanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>


Code: C#
protected void Page_Load(object sender, EventArgs e)
    {
		MasterPages_Intranet master = (MasterPages_Intranet)Master;
		master.PageSecurityGroup = "HRS_Intranet_CMS_Intranet";

		if (!Page.IsPostBack)
			LoadPage(0);
    }
	override protected void OnInit(EventArgs e)
	{
		this.CallbackPanel1.Execute += new EO.Web.CallbackEventHandler(this.CallbackPanel1_Execute);
		base.OnInit(e);
	}

	private void LoadPage(int index)
	{
		//Load the new page content
		System.Web.UI.Control tabPageContent = null;
		switch (index)
		{
			case 0:
				tabPageContent = LoadControl("Tabs/Pages.ascx");
				break;
			case 1:
				tabPageContent = LoadControl("Tabs/Files.ascx");
				break;
			default:
				tabPageContent = LoadControl("Tabs/Pages.ascx");
				break;
		}
		CallbackPanel1.Controls.Add(tabPageContent);
	}

	private void CallbackPanel1_Execute(object sender, EO.Web.CallbackEventArgs e)
	{
		LoadPage(int.Parse(e.Parameter));
	}


And now for a tab, this is the Pages.ascx file
Code: HTML/ASPX
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Pages.ascx.cs" Inherits="Intranet_CMS_Tabs_Pages" %>
Test
<asp:Button ID="btn1" runat="server" Text="Kill the Kitty" OnClick="KillIt" />
<asp:Label ID="lbl1" runat="server" Text="Ohh Noes!!!" Visible="false" />


Code: C#
protected void KillIt(object sender, EventArgs e)
	{
		lbl1.Visible = true;
	}


I am assuming that I'm missing some code that causes the CallbackPanel to load the last selected tabs ascx file, but as I said, still a little fuzzy on how this thing works.

Also, what is the difference between the "built in" Update Panel from Microsoft and your AJAX controls (callbackpanel and callback)? Which should I be using here and should I be mixing them like this?
advantages and disadvantages?

Thanks guys!


David L. Sargent
Developer
Washington State University
eo_support
Posted: Thursday, September 20, 2007 4:25:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi David,

You need to do your dynamic loading in Page_Init instead of Page_Load. This topic explained why:

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

Generally you will also need to remember your last loaded page and reload it in Page_Init. Check Default.aspx in your demo project, it does exactly that.

Thanks
Sarge
Posted: Friday, September 21, 2007 10:54:32 AM

Rank: Member
Groups: Member

Joined: 9/14/2007
Posts: 21
OK, I get the pageinit thing, but I'm affraid I'm still not getting the order of things quite right.

First, do I need to use the javascript as was in the demo and my code below, or can I do this with all server side stuff?

Second, the code in the demos default.aspx is doing a lot more than I need and I'm having a tough time figuring out what I need out of it. I know I need to figure out what tab last selected and load it's user control, and I've played with different methods of doing it, but I keep running into loops, or other bizarre problems. Can you please give some code examples given my code in the first post?

Third, can y answer the questions I had at the end of the code in the first post.

Thanks guys! Sorry for being a bone head on this.

David L. Sargent
Developer
Washington State University
eo_support
Posted: Friday, September 21, 2007 11:02:30 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Sarge wrote:
I know I need to figure out what tab last selected and load it's user control, and I've played with different methods of doing it, but I keep running into loops, or other bizarre problems.


That's the key and I do not think there is anyway around it. If you run into other problems by doing that, then you will need to adress those problems.

A much easy workaround for you would be put all the user controls inside the page, but then show/hide them dynamically (instead of creating them dynamically), so the control tree does not change, but the controls' Visible property changes. That way you avoid the whole dynamic loading mess, which can get very complicated if you are not certain about the details under the hood.
Sarge
Posted: Friday, September 21, 2007 11:18:31 AM

Rank: Member
Groups: Member

Joined: 9/14/2007
Posts: 21
Thanks for the quick response. It's just too bad the advice is useless, doesn't take time to fully answer the question and frankly is a little insulting.

If you are attempting to provide tech support via these forums either fully answer the question as you are surely capable, or don't bother.

You advertise that the tab control + callback panel are easy to use and are designed specifically for this purpose. Your code examples go so far as to provide the illusion of such a thing working, but do not give the user the necessary capability to actually get them to work. For example, in the code examples of which I modeled this page off of, you should have other controls in there, performing post backs. You should have examples of how to keep the controls working, etc.
Another example would be the File Uploader. All of your code examples go as far as getting the file on the server in a temporary format, none of them have any code detailing what your supposed to do with it thereafter. Not very useful.

If your samples where more complete, I'm quite sure you'd have less traffic on these boards.

Now, my problem is that I have a CMS with 6,500 lines of code 1,100 lines of controls and I really need to break it up into the ififerent ASCX user controls and would really like to load them dynamically. My current technique already uses a tab like device with a multiview and hiding and unhiding the various controls. I was hoping your controls could help in this regard. Was I wrong?

Also, you keep tell me what I need to do, when I already know what I need to do. What I need you to do is tell me how I need to do it.

David L. Sargent
Developer
Washington State University
eo_support
Posted: Friday, September 21, 2007 11:51:15 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi David,

I am sorry that you feel offended. We have answered many many of your questions during the week, yourself have said that "your support rocks!" . What you need to understand is that while we firmly stand behind our controls and try our best to help you out whenever possible, it is impossible for us to baby sit you through your whole project.

We don't mean to offend you, but our goal is support our product, not to teach you ASP.NET. Dynamic loading is an ASP.NET topic that has nothing to do with our controls. It just happened that our sample project works the same way, so we thought it might help if you take a look of it. What you would do if you use standard ASP.NET controls, for example, a list of link buttons, instead of the TabStrip to do dynamic loading? Would that be any different than using our TabStrip as far as for dynamic loading concerns? Absolutely not. It just happened that we demonstrated this idea with our TabStrip.

We have went as far as telling you exactly how to do it, and showed you where to look. There really isn't much esle we can tell you ---- unfortunately you are the programmer that has to work with 6,500 lines of code; We are doing our best to help, but it's just impossible for us to look into 6,500 lines of code for every of our clients, not to mention that the problem is not even related to our product. Nobody can afford to do so.

Once again, I feel sorry that you are offended, but at the same time, I would appreciate if you can understand from our point of view.

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.