473,769 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom webcontrol

Hi,

I use the infragistics tabcontrol on several pages of my application,
that looks like this:

<igtab:UltraWeb Tab ID="MyTabPage" runat="server">
<Tabs>
<igtab:Tab Key="Tab1" Text="Title for tab 1">
<ContentTemplat e>
Content of tab 1, can contain usercontrols or
webcontrols
</ContentTemplate >
</igtab:Tab>
<igtab:Tab Key="Tab2" Text="Title for tab 2">
<ContentTemplat e>
Content of tab 2, can contain usercontrols or
webcontrols
</ContentTemplate >
</igtab:Tab>
</Tabs>
</igtab:UltraWebT ab>
</ao:Panel>

I tried creating my own tabcontrol, internally using the infragistics
tabcontrol to do it. The markup now looks like:

<ao:TabView runat="server" ID="MyTabPage" >
<ao:Tab runat="server" ID="Tab1" Title="Title for tab 1">
Content of tab 1, can contain usercontrols or webcontrols
</ao:Tab>
<ao:Tab runat="server" ID="Tab2" Title="Title for tab 2">
Content of tab 2, can contain usercontrols or webcontrols
</ao:Tab>
</ao:TabView>

On the first tab, there are some controls in the markup that are set
to Invisible = true in the code behind of the page (on prerender).
Also, the second tab is set to Invisible = false in the code behind of
the page (on prerender).

There is also a button on the page, and when clicked, the second tab
is changed to Visible = true, in other words: there is a postback that
changes the second tab from invisible to visible.
For the infragistics tabcontrol, this is done by:
MyTabPage.Tabs[1].Visible = false;
For my custom tabcontrol, this is done with the same syntax:
MyTabPage.Tabs[1].Visible = false;

Now the problem: when using the infragistics tabcontrol and switching
the second tab from invisible to visible, the invisible controls on
the first tab stay invisible. In my custom tabcontrol, the invisible
controls on the first tab become visible as well, and of course I
don't want that. I'm probably making a beginners mistake (because I am
a beginner), but I have no clue what the source of the problem is...

Here is my code:

[DefaultProperty ("Tabs"),
ParseChildren(t rue, "Tabs")]
public class TabView : CompositeContro l, INamingContaine r
{
private List<Tab_tabs;
private UltraWebTab _ultraWebTab;

protected override void CreateChildCont rols()
{
Controls.Clear( );

_ultraWebTab = new UltraWebTab();
foreach(Tab tab in Tabs)
{
Infragistics.We bUI.UltraWebTab .Tab tabItem = new
Infragistics.We bUI.UltraWebTab .Tab(tab.Title) ;
tabItem.Key = tab.ID;
tabItem.Content Pane.Controls.A dd(tab);
_ultraWebTab.Ta bs.Add(tabItem) ;
}
this.Controls.A dd(_ultraWebTab );
ChildControlsCr eated = true;

ClearChildViewS tate();
}
[DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content),
PersistenceMode (PersistenceMod e.InnerDefaultP roperty)]
public List<TabTabs
{
get
{
if (_tabs == null)
_tabs = new List<Tab>();
return _tabs;
}
}

protected override void OnPreRender(Eve ntArgs e)
{
base.OnPreRende r(e);
EnsureChildCont rols();
foreach (Infragistics.W ebUI.UltraWebTa b.Tab tabItem in
_ultraWebTab.Ta bs)
{
if (tabItem.Conten tPane.Controls. Count == 1)
{
Tab tab = tabItem.Content Pane.Controls[0] as Tab;
if (tab != null)
tabItem.Visible = tab.Visible;
}
}
}
}

public class Tab : Panel, INamingContaine r
{
public string Title
{
get
{
return (string)ViewSta te["TabTitle"] ?? "";
}
set
{
ViewState["TabTitle"] = value;
}
}

public override bool Visible
{
get
{
return (bool?)ViewStat e["VisibleTab "] ?? true;
}
set
{
ViewState["VisibleTab "] = value;
}
}
}

May 24 '07 #1
1 4623
On 24 mei, 09:52, Veerle <veerleve...@ho tmail.comwrote:
On the first tab, there are some controls in the markup that are set
to Invisible = true in the code behind of the page (on prerender).
Also, the second tab is set to Invisible = false in the code behind of
the page (on prerender).
I forgot to mention something important:
I only set the controls on the first tab to Invisible = true in the
prerender when it's not a postback. When I also set it when it is a
postback, then the problem is solved. But when using the Infragistics
control, it does work when only setting the Invisible when it's not a
postback, so I would really like to get that to work in my custom
tabcontrol as well!
May 24 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
2987
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
1
2734
by: Divya | last post by:
Hello This is my 1st project where I have to create a Webcontrol. I have created a simple custom control with a button and 2 labels added to a panel. My problem is that the event handler that I have assigned to the button , is not getting invoked. Could anyone please go thru the code and let me know what I am missing here? Thanks in advance My custom control is as follows using System using System.Web using System.Web.UI using...
2
5930
by: Novice | last post by:
I can't seem to get my Custom WebControl to output a button whose click event is associated with a particular method. Here is the code I have right now that contains a panel and there is a button in that panel that should be associated with a event method - but it isn't working: protected override void Render(HtmlTextWriter output) { Panel panel = new Panel(); nextButton = new Button();
0
1818
by: Novice | last post by:
Hey all, I've already posted this question and two posters offered suggestions and they worked - but now I would like to know why - and if possible the answer to a second question. Here is my problem: I am trying to write a custom WebControl - at some point this WebControl will output a bunch of controls into several Panel objects. But I just recently got my WebControl to output a single button and attach an event handler to that...
1
1917
by: Novice | last post by:
Hey all, I have finally managed to create a Custom WebControl and am using a technique from another programmer to maintain state between pages - I would just like to validate this idea. Basically I have created a Custom Web Control that is capable of generating multiple webpages. It actually only creates one webpage, but hides Panels (that contain the web controls - TextBox's, Labels, etc) to give the impression that the user is...
1
2273
by: Peter | last post by:
I have a dilemna. Currently I have created a custom calendar webcontrol that a user can select and will dump the date along with some specialized information set in the tooltip. It actually is working great. However I am having the same second thoughts about the control as everyone else because of all the real estate it takes up so I would like to add a button to alternately hide/display the calendar control. The only problem is that if I...
1
6101
by: Jeremy Chapman | last post by:
I have a property will an array of webcontrols. The control features a custom property editor which can add and remove web controls to the array, but how do I persist the informtion by serializing it to the aspx page? For example, right now, here is what the html looks like when I drag my control on to the page and add some web controls to the ControlList property:
2
2543
by: Peter Rilling | last post by:
Okay, I something weird is happening where I do not know if I am doing something wrong. I have a page that contains a custom webcontrol that I developed. This webcontrol basically loads a UserControl (ascx) using the LoadControl method and writing it out to the browser. Page --> custom webcontrol --> usercontrol (via LoadControl) --> stream to browser.
1
1100
by: rn5a | last post by:
While creating a custom control, what is the difference between Public Class MyCls : Inherits Control & Public Class MyCls : Inherits WebControl Also when should the sub Render be used & when should the sub RenderContents be used?
4
2529
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi, I have built a custom control button which inherits from WebControl and implements IPostBackEventHandler. The control also declares an event Click and provides a method OnClick which invokes the registered delegate. All is fine with my control until I try to add it to the page dynamically in a code behind event handler and wire-up the click event using the normal syntax such that; protected void btnNew_Click(object sender, EventArgs...
0
9420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10205
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7401
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.