Combining Two Controls, best way?

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Combining Two Controls, best way?

    I have a working date picker, and I want to combine it at the control
    level with a textbox and validator, so we can use
    <my:datepickertextboxthingy/>

    What is the best way to go about this? I am most concerned with access
    to the textbox's properties, since this will function mostly as a
    textbox with a mostly-inert object attached to it.

    Right now I have subclassed TextBox, and am attempting to somehow
    attach the other control to it so they both get rendered. In the end I
    think I would like to be able to wrap them in more html (tables, span,
    div, etc), so I think I will need a little more control. In the end I
    need to be here :

    <my:textbox CssClass="Fun" Columns="10" ..more textbox props.../>

    Where should I instantiate the addtional controls? How should I handle
    prerender (the date picker needs it)? What should I do in Render() to
    make this happen...

    I guess I am really trying to avoid writing properties that wrap *all*
    of the textbox properties. Any good way to do this?

    TIA,
    - Andrew Backer

    Andrew Backer Guest

  2. Similar Questions and Discussions

    1. Control.Controls bug? Control's child controls missing at the run time.
      Hello, ..NET 1.1/VB.NET: I have a custom web control Public Class DatePicker Inherits Control Implements INamingContainer
    2. Why the properties of web user controls which inherted from my custom base UI controls MISSED?
      Why the properties of web user controls which inherted from my custom base UI controls MISSED? How should I to set enable?
    3. Combining scripts
      Is there any rule on how to combine scripts targetting the same MovieClip? I have the following scipts: Alpha tweening: text4_mc._alpha = 0;...
    4. user controls: dynamiclly added child controls dont survive post back ?
      hi, i have some strange behaviour: i've created a web user control that add's some child controls (e.g: textbox, image buttons) to its control...
    5. Combining Fields
      Look up 'ISNULL' and COALESCE' in BOL. "Greg" <gmanship@wvmls.com> a écrit dans le message de news: us3E67MQDHA.3192@tk2msftngp13.phx.gbl...
  3. #2

    Default Re: Combining Two Controls, best way?

    I suggest you create a composite control.
    Here are the details:
    [url]http://SteveOrr.net/articles/ComboBox.aspx[/url]

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    [url]http://SteveOrr.net[/url]


    "Andrew Backer" <awbacker@gmail.com> wrote in message
    news:1121300837.840407.160400@z14g2000cwz.googlegr oups.com...
    >I have a working date picker, and I want to combine it at the control
    > level with a textbox and validator, so we can use
    > <my:datepickertextboxthingy/>
    >
    > What is the best way to go about this? I am most concerned with access
    > to the textbox's properties, since this will function mostly as a
    > textbox with a mostly-inert object attached to it.
    >
    > Right now I have subclassed TextBox, and am attempting to somehow
    > attach the other control to it so they both get rendered. In the end I
    > think I would like to be able to wrap them in more html (tables, span,
    > div, etc), so I think I will need a little more control. In the end I
    > need to be here :
    >
    > <my:textbox CssClass="Fun" Columns="10" ..more textbox props.../>
    >
    > Where should I instantiate the addtional controls? How should I handle
    > prerender (the date picker needs it)? What should I do in Render() to
    > make this happen...
    >
    > I guess I am really trying to avoid writing properties that wrap *all*
    > of the textbox properties. Any good way to do this?
    >
    > TIA,
    > - Andrew Backer
    >

    Steve C. Orr [MVP, MCSD] Guest

  4. #3

    Default Re: Combining Two Controls, best way?

    So I have to go the composite way, eh? Oh well...

    Are we sure that there is no way to inherit TextBox, thereby gaining
    all it's fancy properties and methods, and *then* tacking on the
    datepicker/checkbox/etc that I need?

    Im going to go the composite way for now, but the other way would be
    sooooooo nifty :)

    Thanks for the article,
    - Andrew Backer

    Andrew Backer Guest

Posting Permissions

  • You may not post new threads
  • You may 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