PlaceHolders

  • Thread starter Thread starter Colin Basterfield
  • Start date Start date
C

Colin Basterfield

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
 
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
 
Maybe you need to add one more control... a literal containing "<br>" ?

Colin Basterfield said:
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 said:
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,

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 said:
Maybe you need to add one more control... a literal containing "<br>" ?

Colin Basterfield said:
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 said:
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
 
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 said:
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 said:
Maybe you need to add one more control... a literal containing "<br>" ?

Colin Basterfield said:
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

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
 
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 said:
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 said:
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
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

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
 
Back
Top