Deepz

Deepz

  • NA
  • 25
  • 25k

Creating a font property for a Custom Composite Control.

Apr 5 2007 6:24 AM

Hi All,

           In one of my ongoing ASP.NET project (Framwork 1.1), I need to create a custom composite control. The control contains couple of labels and textboxes. I created some backcolor and forecolor properties for those child controls. But I am facing one problem here though. I also want to create a font property specifically for a child Label control. I created one property of type "FontInfo". Now this property works in the design time. Like if set the "bold = true" in that property, it turns the lable text in bold. But on running the page, on which the control is embedded, label text doesn't get shown in bold.

here is the code:

//2. Filter Field Font Property

//---------------------------------

[Description("Font property for Filter Field Label Text.")]

public FontInfo filterFieldFont

{

get

{

EnsureChildControls();

return lblFilterField.Font;

}

set

{

EnsureChildControls();

lblFilterField.Font.CopyFrom(

value);

//We directly can't set the Font property of the control

// as it is read only. I found this CopyFrom() method only

//to do the needfull. Am I Missing something.

}

}

//##-----------------------------##

 

please help!!! as it is very urgent.

thanks


Answers (2)