Composite Control - Control sizing

Discussion in 'ASP .Net' started by Eric, Sep 11, 2007.

  1. Eric

    Eric Guest

    I have created a fairly basic composite control consisting of a Label
    and a TextBox. In the overridden Render function, I'm creating a
    table with two rows and each row contains a cell (td). The Label and
    the TextBox are each rendered in one of the cells. Everything renders
    fine. The problem is that depending on the column the control
    represents I may want the textbox to be a different visible size
    during both design and runtime. I exposed a public property of the
    control to allow setting of the TextBox.Columns property but it does
    not seem to have any effect.

    Help would be appreciated.
    Eric, Sep 11, 2007
    #1
    1. Advertising

  2. The Columns property of a TextBox sets the "size" HTML attribute of the
    TextBox. This may be overridden by CSS styles. Other than that, I don't know
    what you mean by "does not seem to have any effect."

    --
    HTH,

    Kevin Spencer
    Microsoft MVP

    DSI PrintManager, Miradyne Component Libraries:
    http://www.miradyne.net

    "Eric" <> wrote in message
    news:...
    >I have created a fairly basic composite control consisting of a Label
    > and a TextBox. In the overridden Render function, I'm creating a
    > table with two rows and each row contains a cell (td). The Label and
    > the TextBox are each rendered in one of the cells. Everything renders
    > fine. The problem is that depending on the column the control
    > represents I may want the textbox to be a different visible size
    > during both design and runtime. I exposed a public property of the
    > control to allow setting of the TextBox.Columns property but it does
    > not seem to have any effect.
    >
    > Help would be appreciated.
    >
    Kevin Spencer, Sep 12, 2007
    #2
    1. Advertising

  3. Eric

    eric Guest

    Kevin,
    Thanks for the reply. I guess what I'm looking for is the ability to
    anchor the Label control and TextBox control to the composite control
    container. If I resize the composite control, I would like the two
    contained controls to re-size with it (at least the width). What I meant by
    setting the Columns property of the TextBox has no effect is that changing
    the value of the Columns property of the Textbox contained in the composite
    control does not change its length.

    <form id="form1" runat="server">
    <div>
    <asp:TextBox Columns="50" runat="server" ID="TB1"></asp:TextBox>
    //expands the visible width of the TextBox
    <abc:MyComposite TextBoxLength="50" runat="server"
    ID="TB2"></abc:MyComposite>//In my composite control TextBoxLength changes
    the Column value of the TextBox but it does not work
    </div>
    </form>


    "Kevin Spencer" <> wrote in message
    news:%...
    > The Columns property of a TextBox sets the "size" HTML attribute of the
    > TextBox. This may be overridden by CSS styles. Other than that, I don't
    > know what you mean by "does not seem to have any effect."
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    >
    > DSI PrintManager, Miradyne Component Libraries:
    > http://www.miradyne.net
    >
    > "Eric" <> wrote in message
    > news:...
    >>I have created a fairly basic composite control consisting of a Label
    >> and a TextBox. In the overridden Render function, I'm creating a
    >> table with two rows and each row contains a cell (td). The Label and
    >> the TextBox are each rendered in one of the cells. Everything renders
    >> fine. The problem is that depending on the column the control
    >> represents I may want the textbox to be a different visible size
    >> during both design and runtime. I exposed a public property of the
    >> control to allow setting of the TextBox.Columns property but it does
    >> not seem to have any effect.
    >>
    >> Help would be appreciated.
    >>

    >
    >
    eric, Sep 12, 2007
    #3
  4. The "size" attribute of an HTML text box(input type="text') is an HTML
    attribute that sets the size (width) of the text box in characters. Can you
    post the actual HTML generated for the composite control? That would yield
    more information.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP

    DSI PrintManager, Miradyne Component Libraries:
    http://www.miradyne.net

    "eric" <7ak@!_df.com> wrote in message
    news:...
    > Kevin,
    > Thanks for the reply. I guess what I'm looking for is the ability to
    > anchor the Label control and TextBox control to the composite control
    > container. If I resize the composite control, I would like the two
    > contained controls to re-size with it (at least the width). What I meant
    > by setting the Columns property of the TextBox has no effect is that
    > changing the value of the Columns property of the Textbox contained in the
    > composite control does not change its length.
    >
    > <form id="form1" runat="server">
    > <div>
    > <asp:TextBox Columns="50" runat="server" ID="TB1"></asp:TextBox>
    > //expands the visible width of the TextBox
    > <abc:MyComposite TextBoxLength="50" runat="server"
    > ID="TB2"></abc:MyComposite>//In my composite control TextBoxLength changes
    > the Column value of the TextBox but it does not work
    > </div>
    > </form>
    >
    >
    > "Kevin Spencer" <> wrote in message
    > news:%...
    >> The Columns property of a TextBox sets the "size" HTML attribute of the
    >> TextBox. This may be overridden by CSS styles. Other than that, I don't
    >> know what you mean by "does not seem to have any effect."
    >>
    >> --
    >> HTH,
    >>
    >> Kevin Spencer
    >> Microsoft MVP
    >>
    >> DSI PrintManager, Miradyne Component Libraries:
    >> http://www.miradyne.net
    >>
    >> "Eric" <> wrote in message
    >> news:...
    >>>I have created a fairly basic composite control consisting of a Label
    >>> and a TextBox. In the overridden Render function, I'm creating a
    >>> table with two rows and each row contains a cell (td). The Label and
    >>> the TextBox are each rendered in one of the cells. Everything renders
    >>> fine. The problem is that depending on the column the control
    >>> represents I may want the textbox to be a different visible size
    >>> during both design and runtime. I exposed a public property of the
    >>> control to allow setting of the TextBox.Columns property but it does
    >>> not seem to have any effect.
    >>>
    >>> Help would be appreciated.
    >>>

    >>
    >>

    >
    >
    Kevin Spencer, Sep 13, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sleigh
    Replies:
    1
    Views:
    2,666
    sleigh
    Feb 12, 2004
  2. Tina

    Sizing a Grid Layout control?

    Tina, Jun 17, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    375
    =?Utf-8?B?U2FuZHk=?=
    Jun 17, 2005
  3. Chad
    Replies:
    0
    Views:
    209
  4. Eric

    Composite Control - Control sizing

    Eric, Sep 10, 2007, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    721
  5. Mike

    Composite vs non composite Controls

    Mike, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    248
    Sundararajan
    Mar 11, 2005
Loading...

Share This Page