PlaceHolders

Discussion in 'ASP .Net' started by Colin Basterfield, Dec 23, 2003.

  1. Hi,

    I have some placeholders in my .aspx file, and when I add my controls to
    them at runtime I want them to appear in specific positions on the web form,
    however there are already some controls that appear statically, but the run
    time created controls overwrite them, so is there a way to force the dynamic
    controls to appear below them, or anywhere I choose really?

    Also my PlaceHolders have ids of "actname1", "actname2", "actname3" etc, so
    is there a way that in my code I can use the same code to effectively do
    this for each

    Label aLabel = new Label();
    aLabel.Text = dataRow["activity_name"].ToString()
    actname1.Controls.Add(aLabel)

    All I want to do is add the appropriate number to the tail end of the
    placeholder id, so something like

    actname + <rownumber>.Controls.Add(aLabel)

    I guess I could iterate thro the Page controls find all the placeholders and
    store their references in a list using the row number as an index to the
    appropriate placeholder reference???

    Any thoughts out there on Xmas Eve, well it is here in NZ! :)

    TIA
    Colin B
    Colin Basterfield, Dec 23, 2003
    #1
    1. Advertising

  2. Re: PlaceHolders - progress!

    Hello again,

    As I wanted my controls to appear in specific positions on the web form, I
    wrapped each one with a <div></div> pair, I set the style on each <div> to
    position the contents specifically which on viewing the design page it has
    placed the placeholders underneath each other, as I want, but when I run it,
    and add my new label+text to each one's Controls array the controls are
    simply next to each other in a line, not underneath each other as at design
    time... :-(

    Any thoughts?
    TIA
    Colin

    "Colin Basterfield" <> wrote in message
    news:%...
    > Hi,
    >
    > I have some placeholders in my .aspx file, and when I add my controls to
    > them at runtime I want them to appear in specific positions on the web

    form,
    > however there are already some controls that appear statically, but the

    run
    > time created controls overwrite them, so is there a way to force the

    dynamic
    > controls to appear below them, or anywhere I choose really?
    >
    > Also my PlaceHolders have ids of "actname1", "actname2", "actname3" etc,

    so
    > is there a way that in my code I can use the same code to effectively do
    > this for each
    >
    > Label aLabel = new Label();
    > aLabel.Text = dataRow["activity_name"].ToString()
    > actname1.Controls.Add(aLabel)
    >
    > All I want to do is add the appropriate number to the tail end of the
    > placeholder id, so something like
    >
    > actname + <rownumber>.Controls.Add(aLabel)
    >
    > I guess I could iterate thro the Page controls find all the placeholders

    and
    > store their references in a list using the row number as an index to the
    > appropriate placeholder reference???
    >
    > Any thoughts out there on Xmas Eve, well it is here in NZ! :)
    >
    > TIA
    > Colin B
    >
    >
    Colin Basterfield, Dec 24, 2003
    #2
    1. Advertising

  3. Re: PlaceHolders - progress!

    Maybe you need to add one more control... a literal containing "<br>" ?

    "Colin Basterfield" <> wrote in message
    news:...
    > Hello again,
    >
    > As I wanted my controls to appear in specific positions on the web form, I
    > wrapped each one with a <div></div> pair, I set the style on each <div> to
    > position the contents specifically which on viewing the design page it has
    > placed the placeholders underneath each other, as I want, but when I run
    > it,
    > and add my new label+text to each one's Controls array the controls are
    > simply next to each other in a line, not underneath each other as at
    > design
    > time... :-(
    >
    > Any thoughts?
    > TIA
    > Colin
    >
    > "Colin Basterfield" <> wrote in message
    > news:%...
    >> Hi,
    >>
    >> I have some placeholders in my .aspx file, and when I add my controls to
    >> them at runtime I want them to appear in specific positions on the web

    > form,
    >> however there are already some controls that appear statically, but the

    > run
    >> time created controls overwrite them, so is there a way to force the

    > dynamic
    >> controls to appear below them, or anywhere I choose really?
    >>
    >> Also my PlaceHolders have ids of "actname1", "actname2", "actname3" etc,

    > so
    >> is there a way that in my code I can use the same code to effectively do
    >> this for each
    >>
    >> Label aLabel = new Label();
    >> aLabel.Text = dataRow["activity_name"].ToString()
    >> actname1.Controls.Add(aLabel)
    >>
    >> All I want to do is add the appropriate number to the tail end of the
    >> placeholder id, so something like
    >>
    >> actname + <rownumber>.Controls.Add(aLabel)
    >>
    >> I guess I could iterate thro the Page controls find all the placeholders

    > and
    >> store their references in a list using the row number as an index to the
    >> appropriate placeholder reference???
    >>
    >> Any thoughts out there on Xmas Eve, well it is here in NZ! :)
    >>
    >> TIA
    >> Colin B
    >>
    >>

    >
    >
    Ken Cox [Microsoft MVP], Dec 24, 2003
    #3
  4. Re: PlaceHolders - progress!

    Ken,

    Thanks for that but it doesn't make any difference, they still appear one
    after the other in a line, so not sure how to proceed now.

    I am having a real baptism by fire with HTML, and to a lesser extent
    ASP.NET, which keeps me amused... :)

    Any more thoughts?
    Thanks again
    Colin

    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:%...
    > Maybe you need to add one more control... a literal containing "<br>" ?
    >
    > "Colin Basterfield" <> wrote in message
    > news:...
    > > Hello again,
    > >
    > > As I wanted my controls to appear in specific positions on the web form,

    I
    > > wrapped each one with a <div></div> pair, I set the style on each <div>

    to
    > > position the contents specifically which on viewing the design page it

    has
    > > placed the placeholders underneath each other, as I want, but when I run
    > > it,
    > > and add my new label+text to each one's Controls array the controls are
    > > simply next to each other in a line, not underneath each other as at
    > > design
    > > time... :-(
    > >
    > > Any thoughts?
    > > TIA
    > > Colin
    > >
    > > "Colin Basterfield" <> wrote in message
    > > news:%...
    > >> Hi,
    > >>
    > >> I have some placeholders in my .aspx file, and when I add my controls

    to
    > >> them at runtime I want them to appear in specific positions on the web

    > > form,
    > >> however there are already some controls that appear statically, but the

    > > run
    > >> time created controls overwrite them, so is there a way to force the

    > > dynamic
    > >> controls to appear below them, or anywhere I choose really?
    > >>
    > >> Also my PlaceHolders have ids of "actname1", "actname2", "actname3"

    etc,
    > > so
    > >> is there a way that in my code I can use the same code to effectively

    do
    > >> this for each
    > >>
    > >> Label aLabel = new Label();
    > >> aLabel.Text = dataRow["activity_name"].ToString()
    > >> actname1.Controls.Add(aLabel)
    > >>
    > >> All I want to do is add the appropriate number to the tail end of the
    > >> placeholder id, so something like
    > >>
    > >> actname + <rownumber>.Controls.Add(aLabel)
    > >>
    > >> I guess I could iterate thro the Page controls find all the

    placeholders
    > > and
    > >> store their references in a list using the row number as an index to

    the
    > >> appropriate placeholder reference???
    > >>
    > >> Any thoughts out there on Xmas Eve, well it is here in NZ! :)
    > >>
    > >> TIA
    > >> Colin B
    > >>
    > >>

    > >
    > >

    >
    Colin Basterfield, Dec 24, 2003
    #4
  5. Re: PlaceHolders - progress!

    Hi Colin,

    Perhaps you could show us the HTML code output that you are getting? That
    way we could work on getting the result right.

    Hmmmm... are you using absolute positioning? That might be defeating other
    code that attempts to use layout mode.

    "Colin Basterfield" <> wrote in message
    news:...
    > Ken,
    >
    > Thanks for that but it doesn't make any difference, they still appear one
    > after the other in a line, so not sure how to proceed now.
    >
    > I am having a real baptism by fire with HTML, and to a lesser extent
    > ASP.NET, which keeps me amused... :)
    >
    > Any more thoughts?
    > Thanks again
    > Colin
    >
    > "Ken Cox [Microsoft MVP]" <> wrote in message
    > news:%...
    >> Maybe you need to add one more control... a literal containing "<br>" ?
    >>
    >> "Colin Basterfield" <> wrote in message
    >> news:...
    >> > Hello again,
    >> >
    >> > As I wanted my controls to appear in specific positions on the web
    >> > form,

    > I
    >> > wrapped each one with a <div></div> pair, I set the style on each <div>

    > to
    >> > position the contents specifically which on viewing the design page it

    > has
    >> > placed the placeholders underneath each other, as I want, but when I
    >> > run
    >> > it,
    >> > and add my new label+text to each one's Controls array the controls are
    >> > simply next to each other in a line, not underneath each other as at
    >> > design
    >> > time... :-(
    >> >
    >> > Any thoughts?
    >> > TIA
    >> > Colin
    >> >
    >> > "Colin Basterfield" <> wrote in message
    >> > news:%...
    >> >> Hi,
    >> >>
    >> >> I have some placeholders in my .aspx file, and when I add my controls

    > to
    >> >> them at runtime I want them to appear in specific positions on the web
    >> > form,
    >> >> however there are already some controls that appear statically, but
    >> >> the
    >> > run
    >> >> time created controls overwrite them, so is there a way to force the
    >> > dynamic
    >> >> controls to appear below them, or anywhere I choose really?
    >> >>
    >> >> Also my PlaceHolders have ids of "actname1", "actname2", "actname3"

    > etc,
    >> > so
    >> >> is there a way that in my code I can use the same code to effectively

    > do
    >> >> this for each
    >> >>
    >> >> Label aLabel = new Label();
    >> >> aLabel.Text = dataRow["activity_name"].ToString()
    >> >> actname1.Controls.Add(aLabel)
    >> >>
    >> >> All I want to do is add the appropriate number to the tail end of the
    >> >> placeholder id, so something like
    >> >>
    >> >> actname + <rownumber>.Controls.Add(aLabel)
    >> >>
    >> >> I guess I could iterate thro the Page controls find all the

    > placeholders
    >> > and
    >> >> store their references in a list using the row number as an index to

    > the
    >> >> appropriate placeholder reference???
    >> >>
    >> >> Any thoughts out there on Xmas Eve, well it is here in NZ! :)
    >> >>
    >> >> TIA
    >> >> Colin B
    >> >>
    >> >>
    >> >
    >> >

    >>

    >
    >
    Ken Cox [Microsoft MVP], Dec 24, 2003
    #5
  6. Re: PlaceHolders - progress!

    Not sure if a dim view is taken of attaching a file, but given that you
    asked for HTML, then unles I attach it you won't see it in the message.

    If the moderator is reading, please accept my apologies, and perhaps suggest
    a way of achieving the requirement

    I am using absolute positioning, so I will play around with that whilst I
    wait for a reply :)

    Cheers Ken
    Colin

    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:eI$...
    > Hi Colin,
    >
    > Perhaps you could show us the HTML code output that you are getting? That
    > way we could work on getting the result right.
    >
    > Hmmmm... are you using absolute positioning? That might be defeating other
    > code that attempts to use layout mode.
    >
    > "Colin Basterfield" <> wrote in message
    > news:...
    > > Ken,
    > >
    > > Thanks for that but it doesn't make any difference, they still appear

    one
    > > after the other in a line, so not sure how to proceed now.
    > >
    > > I am having a real baptism by fire with HTML, and to a lesser extent
    > > ASP.NET, which keeps me amused... :)
    > >
    > > Any more thoughts?
    > > Thanks again
    > > Colin
    > >
    > > "Ken Cox [Microsoft MVP]" <> wrote in message
    > > news:%...
    > >> Maybe you need to add one more control... a literal containing "<br>" ?
    > >>
    > >> "Colin Basterfield" <> wrote in message
    > >> news:...
    > >> > Hello again,
    > >> >
    > >> > As I wanted my controls to appear in specific positions on the web
    > >> > form,

    > > I
    > >> > wrapped each one with a <div></div> pair, I set the style on each

    <div>
    > > to
    > >> > position the contents specifically which on viewing the design page

    it
    > > has
    > >> > placed the placeholders underneath each other, as I want, but when I
    > >> > run
    > >> > it,
    > >> > and add my new label+text to each one's Controls array the controls

    are
    > >> > simply next to each other in a line, not underneath each other as at
    > >> > design
    > >> > time... :-(
    > >> >
    > >> > Any thoughts?
    > >> > TIA
    > >> > Colin
    > >> >
    > >> > "Colin Basterfield" <> wrote in message
    > >> > news:%...
    > >> >> Hi,
    > >> >>
    > >> >> I have some placeholders in my .aspx file, and when I add my

    controls
    > > to
    > >> >> them at runtime I want them to appear in specific positions on the

    web
    > >> > form,
    > >> >> however there are already some controls that appear statically, but
    > >> >> the
    > >> > run
    > >> >> time created controls overwrite them, so is there a way to force the
    > >> > dynamic
    > >> >> controls to appear below them, or anywhere I choose really?
    > >> >>
    > >> >> Also my PlaceHolders have ids of "actname1", "actname2", "actname3"

    > > etc,
    > >> > so
    > >> >> is there a way that in my code I can use the same code to

    effectively
    > > do
    > >> >> this for each
    > >> >>
    > >> >> Label aLabel = new Label();
    > >> >> aLabel.Text = dataRow["activity_name"].ToString()
    > >> >> actname1.Controls.Add(aLabel)
    > >> >>
    > >> >> All I want to do is add the appropriate number to the tail end of

    the
    > >> >> placeholder id, so something like
    > >> >>
    > >> >> actname + <rownumber>.Controls.Add(aLabel)
    > >> >>
    > >> >> I guess I could iterate thro the Page controls find all the

    > > placeholders
    > >> > and
    > >> >> store their references in a list using the row number as an index to

    > > the
    > >> >> appropriate placeholder reference???
    > >> >>
    > >> >> Any thoughts out there on Xmas Eve, well it is here in NZ! :)
    > >> >>
    > >> >> TIA
    > >> >> Colin B
    > >> >>
    > >> >>
    > >> >
    > >> >
    > >>

    > >
    > >

    >
    Colin Basterfield, Dec 24, 2003
    #6
    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. Bill Belliveau
    Replies:
    0
    Views:
    370
    Bill Belliveau
    Aug 19, 2003
  2. DotNetGruven

    Nested PlaceHolders

    DotNetGruven, Mar 2, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    612
    Steven Cheng[MSFT]
    Mar 5, 2004
  3. buran
    Replies:
    1
    Views:
    413
    Bruno Sirianni
    Apr 6, 2004
  4. Josh
    Replies:
    1
    Views:
    9,547
    Jeffrey Palermo [MCP]
    May 26, 2004
  5. Sinisa Ruzin
    Replies:
    0
    Views:
    862
    Sinisa Ruzin
    Oct 7, 2004
Loading...

Share This Page