473,732 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control refresh design time

I have a custom control with a ListItemCollect ion. If I add items by
hand in the aspx and switch to design time view, everything works fine.

However if I add items through the Collection Editor, the control
doesn't update until I change something in the aspx and change to
design view. I can't understand why because if you try to update a
DropDownList with the
collection editor, the control updates as soon as you change something
in the Collection Editor.

Anybody what I need to add to this code to make the control to update
when changing something with the collection editor?

using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Componen tModel.Design;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.W ebControls;
namespace MyComponents
{
[Serializable]
[ParseChildren(t rue, "Items")]
public class TestControl : WebControl, INamingContaine r
{
private ListItemCollect ion _items;
[DefaultValue(nu ll),
PersistenceMode (PersistenceMod e.InnerDefaultP roperty)]
public ListItemCollect ion Items {
get { return _items; }
}
public override ControlCollecti on Controls {
get {
EnsureChildCont rols();
return base.Controls;
}
}
public TestControl() : base(HtmlTextWr iterTag.Div)
{
_items = new ListItemCollect ion();
}
protected override void CreateChildCont rols()
{
Controls.Add(ne w LiteralControl( "-- TestControl
--<br>"));
for (int i = 0; i < _items.Count; i++){
LiteralControl l = new
LiteralControl( _items[i].Text + "<br>");
Controls.Add(l) ;
}
}
protected override void RenderContents( HtmlTextWriter
writer)
{
foreach(Control ctrl in Controls){
ctrl.RenderCont rol(writer);
}
}
}
}

Nov 19 '05 #1
0 1093

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

Similar topics

2
1245
by: Allan Bredahl | last post by:
Hi all Im currently constructing a Windows control that inherits from RichTextBox, but I'm having a bit of trouble with updating the control at design time. The senario is SIMPLIFIED as follows: My RichTextBox control : Public Class Crtb
0
1031
by: Allan Bredahl | last post by:
Hi all Im currently constructing a Windows control that inherits from RichTextBox, but I'm having a bit of trouble with updating the control at design time. The senario is SIMPLIFIED as follows: My RichTextBox control : Public Class Crtb
0
1087
by: Allan Bredahl | last post by:
Hi all Im currently constructing a Windows control that inherits from RichTextBox, but I'm having a bit of trouble with updating the control at design time. The senario is SIMPLIFIED as follows: My RichTextBox control : Public Class Crtb
0
2276
by: philaphan80 | last post by:
Is there a way to force the Visual Studio IDE (Page Control at design- time) to refresh / repaint itself upon drag & drop of *any* item from the toolbox? Perhaps a method I need to override within the page control? I'm aware of using "ComponentModel.RefreshProperties(RefreshProperties.All)" within custom controls, but that only refreshes the page when something specific to that custom control is changed. I'm looking for a way to hook...
3
4762
by: R.A.F. | last post by:
Hi, I have a custom control in which i have a property based on CollectionBase class. like the following one : //------- XGrid.cs file --------------// public ColumnsCollection Columns {
0
8773
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
9445
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
9306
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...
0
8186
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...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3259
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
2177
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.