Last post Nov 17, 2009 08:00 PM by northdevil
Nov 16, 2009 02:51 AM|northdevil|LINK
I have a custom asp.net control and I want to give it some design time support, so I create a control designer, and override its ActionLists to return my custom DesignerActionList inherits from DesignerActionList class. I override the GetSortedActionItems
property to add a DesignerActionMethodItem, which will create some child controls when user click it. the c# code just like this:
public override DesignerActionItemCollection GetSortedActionItems()
if (_actionItems == null)
_actionItems = new DesignerActionItemCollection();
_actionItems.Add(new DesignerActionMethodItem(this, "AddNewCell", "add new cell", "Behavior"));
public void AddNewCell()
InvokeTransactedChange(Component, DoAddNewCell, "AddNewCell", "add new cell");
public bool DoAddNewCell(object args)
ObjectContainerCell cell = new ObjectContainerCell();
PropertyContainer property = new PropertyContainer();
PropertyContainerCell pc = new PropertyContainerCell();
pc = new PropertyContainerCell();
I test it in vs 2008, I saw the action list with an "add new cell" hyperlink on it. When I click this hyperlink, the design-view of vs 2008's web form designer shows me the change my code have made correctly, but when I switch to the html-view, nothing
expected code was generated.
But, if I change the id of the added child control or resize it, the control's code was generated in html-view.
I have another control designer with the similar function, but it can generate code immediately when the hyperlink such as "add new cell" was clicked. But I can't find the difference between them.
I guess that I should call some method to enforce the web form designer to update the aspx file, just like the ControlDesigner.UpdateDesignTimeHtml() to enforce the designer-view to refresh the design time html.
can anybody help me?
Nov 17, 2009 08:00 PM|northdevil|LINK
maybe there are something wrong in my vs 2008, I have tried in another computer and it works well.