Parent property

Results 1 to 2 of 2

Thread: Parent property

  1. #1
    Join Date
    Dec 1969

    Default Parent property

    Hi,<BR><BR>I wanted to create a server control with a property name Width and Height.But its saying that it already exists.So I think Width and Height already exists in the parent class.<BR><BR>So now I am not creating any property in the server control but straightway sending in the width and height from the aspx page to the server control.<BR><BR>If i do so, it gives me an error as<BR>"Argument &#039;1&#039;: cannot convert from &#039;System.Web.UI.WebControls.Unit&#039; to &#039;string&#039;"<BR><BR>Can anyone help me out of how this can be solved?<BR>I do not want to create a property for width and height with a different name.<BR><BR>Thanks<BR>PHILIP

  2. #2
    Join Date
    Dec 1969

    Default RE: Parent property

    Hi Philip<BR><BR>Your control inherits from System.Web.UI.WebControls which has a width and height property already, you just have to override this in your server control:<BR><BR>[Bindable(true), Category("Appearance"), DefaultValue(150)]<BR>public override Unit Width<BR>{<BR> get{return width;} set{width = value;}<BR>}<BR><BR>I don&#039;t think the attributes in square brackets are necessary<BR>You may have to convert the Unit to an int if you want to manipulate it <BR><BR>Good luck, James

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts