MyCustomControl, ExpandableObjectConverter, OnValueChanged

T

terrorix

I have this contruction:


public sealed class CellOptions
{
public int _CellHeight;
public int _CellWidth;

public int CellHeight
{
set { _CellHeight = value; }
get { return _CellHeight; }
}

public int CellWidth
{
set { _CellWidth = value; }
get { return _CellWidth; }
}
}



public class MyCustomControl : System.Web.UI.WebControls.WebControl
{
....
....
....
[Category("CellOptions"), TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
public CellOptions CellOptions
{
get { return _CellOptions; }
set { _CellOptions = value; }
}
....
....
....
protected override void Render(HtmlTextWriter output)
{
Table tb = new Table();
tb.Rows.Add( new TableRow() );

TableCell cell = new TableCell();

cell.Width = CellOptions.CellWidth; // <-- here i setup table cell width to CellWidth of CellOptions object
cell.Height = CellOptions.CellHeight; // <-- here i setup table cell height to CellHeight of CellOptions object

tb.Rows[0].Cells.Add( cell );

tb.RenderControl(output);
}
....
....
....
}



I want to have CellOptions property of webcontrol MyCustomControl be expandable like Font class in standard WebControl.
This menas in the properties window in VS.NET will be sign + before CellOptions property, this is done by adding attribe
TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter)) to Celloptions property.
But the problem is that if the user change property CellWidth or CellHeight of CellOptions object I want to
MyCustomControl re-Render the control to respect new values of CellWidth or CellHeight. How do i do that?

thanks a lot...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top