Professional Web Applications Themes

Custom Control Font Property - ASP.NET Building Controls

Dear readers, Have a web custom control going but can't seem to manage this easy thing. The custom control inherits from System.Web.UI.WebControls.WebControl. The custom control consists of 2 images and a label. The Custom Control has from default a Font property. How can I use the default Font Property to set the Label Font property? Many thanks, Rémy...

  1. #1

    Default Custom Control Font Property

    Dear readers,

    Have a web custom control going but can't seem to manage this easy
    thing.

    The custom control inherits from System.Web.UI.WebControls.WebControl.
    The custom control consists of 2 images and a label. The Custom
    Control has from default a Font property. How can I use the default
    Font Property to set the Label Font property?

    Many thanks,
    Rémy
    Remy Samulski Guest

  2. #2

    Default Re: Custom Control Font Property

    in place where you want to use default font property like
    Me.Font.Bold for example in Render method:

    if (Me.Font.Bold) then
    output.write("<bold>")
    end if
    output.write (me.Text)
    .....
    if (Me.Font.Bold) then
    output.write("</bold>")
    end if

    "Remy Samulski" <samulskihotmail.com> wrote in message
    news:d10b65f2.0311190538.61665af2posting.google.c om...
    > Dear readers,
    >
    > Have a web custom control going but can't seem to manage this easy
    > thing.
    >
    > The custom control inherits from System.Web.UI.WebControls.WebControl.
    > The custom control consists of 2 images and a label. The Custom
    > Control has from default a Font property. How can I use the default
    > Font Property to set the Label Font property?
    >
    > Many thanks,
    > Rémy

    Nenad Prekupec Guest

  3. #3

    Default Re: Custom Control Font Property

    "Nenad Prekupec" <nenad.prekupecATperpetuum.hr> wrote in message news:<eKjUNsqrDHA.3140TK2MSFTNGP11.phx.gbl>...
    > in place where you want to use default font property like
    > Me.Font.Bold for example in Render method:
    >
    > if (Me.Font.Bold) then
    > output.write("<bold>")
    > end if
    > output.write (me.Text)
    > .....
    > if (Me.Font.Bold) then
    > output.write("</bold>")
    > end if
    Thanks for your reply!

    I prefer .NET Framework to do the HTML makeup. When I set the standard
    Font property of my custom control (prcDecisionPossibleUserSet) I get
    the following HTML result:

    <span id="prcDecisionPossibleUserSet" LaatZien="True"
    style="font-family:Arial;font-size:Smaller;Z-INDEX: 102; LEFT: 976px;
    POSITION: absolute; TOP: 56px">
    <table bordercolor="Green" border="0"
    style="border-color:Green;border-width:2px;border-style:solid;height:32px;width:200px;">
    <tr>
    <td><img src="Images/Decision.gif" border="0"
    style="height:32px;width:15px;" /></td>
    <td align="Center" valign="Middle"><span>LABEL _lblText</span></td>
    <td><img src="Images/Decision_right.gif" border="0"
    style="height:32px;width:15px;" /></td>
    </tr>
    </table>
    </span>

    As you can see the standard font property of my custom control is
    implemented in the first SPAN tag. But the SPAN surrounding the LABEL
    has no font definition. I have tried:
    Me._lblText.Font.CopyFrom(Me.Font) but the SPAN tag stays empty.
    Anyone a suggestion?


    Many thanks
    Remy Samulski Guest

  4. #4

    Default Re: Custom Control Font Property

    according to the source html code you have posted I presume that you need a
    bit customizing either Render or RenderChildren method.
    As I can see you are doing that already but important question is how?!
    at the point where you are rendering that span where you want your font to
    be applied you should use Font properties of your custom control...
    have you tried
    _lblText.Font = Me.Font?
    if this doesn'e work try applying Font on that span?

    "Remy Samulski" <samulskihotmail.com> wrote in message
    news:d10b65f2.0311200114.51d99e9dposting.google.c om...
    > "Nenad Prekupec" <nenad.prekupecATperpetuum.hr> wrote in message
    news:<eKjUNsqrDHA.3140TK2MSFTNGP11.phx.gbl>...
    > > in place where you want to use default font property like
    > > Me.Font.Bold for example in Render method:
    > >
    > > if (Me.Font.Bold) then
    > > output.write("<bold>")
    > > end if
    > > output.write (me.Text)
    > > .....
    > > if (Me.Font.Bold) then
    > > output.write("</bold>")
    > > end if
    >
    > Thanks for your reply!
    >
    > I prefer .NET Framework to do the HTML makeup. When I set the standard
    > Font property of my custom control (prcDecisionPossibleUserSet) I get
    > the following HTML result:
    >
    > <span id="prcDecisionPossibleUserSet" LaatZien="True"
    > style="font-family:Arial;font-size:Smaller;Z-INDEX: 102; LEFT: 976px;
    > POSITION: absolute; TOP: 56px">
    > <table bordercolor="Green" border="0"
    >
    style="border-color:Green;border-width:2px;border-style:solid;height:32px;wi
    dth:200px;">
    > <tr>
    > <td><img src="Images/Decision.gif" border="0"
    > style="height:32px;width:15px;" /></td>
    > <td align="Center" valign="Middle"><span>LABEL _lblText</span></td>
    > <td><img src="Images/Decision_right.gif" border="0"
    > style="height:32px;width:15px;" /></td>
    > </tr>
    > </table>
    > </span>
    >
    > As you can see the standard font property of my custom control is
    > implemented in the first SPAN tag. But the SPAN surrounding the LABEL
    > has no font definition. I have tried:
    > Me._lblText.Font.CopyFrom(Me.Font) but the SPAN tag stays empty.
    > Anyone a suggestion?
    >
    >
    > Many thanks

    Nenad Prekupec Guest

Similar Threads

  1. Custom Control - Collection Property
    By Synced in forum ASP.NET
    Replies: 1
    Last Post: January 17th, 03:33 AM
  2. Custom control with complex property type (System.Web.UI.Control[])
    By Jeremy Chapman in forum ASP.NET Building Controls
    Replies: 0
    Last Post: February 15th, 06:00 PM
  3. Problem w Font property in Custom Control
    By sadhu in forum ASP.NET Building Controls
    Replies: 1
    Last Post: May 23rd, 05:25 PM
  4. Keep custom property-value in custom rendered control
    By Rob Joosen in forum ASP.NET Building Controls
    Replies: 0
    Last Post: May 12th, 11:56 AM
  5. Exposing Font Name Property for Custom Control
    By Deep S. in forum ASP.NET Building Controls
    Replies: 2
    Last Post: August 4th, 10:17 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139