470,624 Members | 2,393 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

Dynamically placing controls/ page items at runtime

I have this table on my form which gets populated with data from my database
at runtime. I would like to place some controls (linkbutton, textbox etc.)
beneath the table when it is complete - at the moment the controls just stay
where I place them and the table gets built on top of them. I have tried
searching the net for a solution but being on dial up its excruciatingly
slow and I havent yet found the answer. Please could someone point me in the
right direction...

I am using c# and asp.net

Thanks,
Grant
Nov 17 '05 #1
7 2293
placing runat="server" to the table and and something like ,
table.Rows[4].Cells[3].Controls.Add(lnkButton); , will work.
Nov 17 '05 #2

"Grant" <gp*****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
I have this table on my form which gets populated with data from my
database at runtime. I would like to place some controls (linkbutton,
textbox etc.) beneath the table when it is complete - at the moment the
controls just stay where I place them and the table gets built on top of
them. I have tried searching the net for a solution but being on dial up
its excruciatingly slow and I havent yet found the answer. Please could
someone point me in the right direction...

I am using c# and asp.net

Thanks,
Grant

Nov 17 '05 #3
All web controls inherit from System.Web.UI.Control which has a property
called 'Controls' this is container of controls hosted by the current
control so you can do the following if you had a Panel control on your aspx
page:

....
TextBox myTextBox = new TextBox();
myPanel.Controls.Add(myTextBox);
....

Or since you are displaying information from a database I guess you are
using a DataGrid or Repeater control both of which support header and footer
templates that allow you to add controls as you wish

here is an article on adding controls to the footer of a datagrid

http://www.extremeexperts.com/Net/Ar...stoFooter.aspx

datagrid girl is always a good resource as well:

http://www.datagridgirl.com/default.aspx

HTH

Ollie Riches

"Grant" <gp*****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
I have this table on my form which gets populated with data from my
database at runtime. I would like to place some controls (linkbutton,
textbox etc.) beneath the table when it is complete - at the moment the
controls just stay where I place them and the table gets built on top of
them. I have tried searching the net for a solution but being on dial up
its excruciatingly slow and I havent yet found the answer. Please could
someone point me in the right direction...

I am using c# and asp.net

Thanks,
Grant

Nov 17 '05 #4
Did "chris" actually say nothing, or is it just not visible via the MS
web-based newsreader?

Thanks.
--
J. Merrill / Analytical Software Corp.
"chris" wrote:

"Grant" <gp*****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
I have this table on my form which gets populated with data from my
database at runtime. I would like to place some controls (linkbutton,
textbox etc.) beneath the table when it is complete - at the moment the
controls just stay where I place them and the table gets built on top of
them. I have tried searching the net for a solution but being on dial up
its excruciatingly slow and I havent yet found the answer. Please could
someone point me in the right direction...

I am using c# and asp.net

Thanks,
Grant


Nov 17 '05 #5
say nothing...

"J. Merrill" <jv************@spamcop.net.nospam> wrote in message
news:D0**********************************@microsof t.com...
Did "chris" actually say nothing, or is it just not visible via the MS
web-based newsreader?

Thanks.
--
J. Merrill / Analytical Software Corp.
"chris" wrote:

"Grant" <gp*****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
>I have this table on my form which gets populated with data from my
>database at runtime. I would like to place some controls (linkbutton,
>textbox etc.) beneath the table when it is complete - at the moment the
>controls just stay where I place them and the table gets built on top of
>them. I have tried searching the net for a solution but being on dial up
>its excruciatingly slow and I havent yet found the answer. Please could
>someone point me in the right direction...
>
> I am using c# and asp.net
>
> Thanks,
> Grant
>


Nov 17 '05 #6
ehhehegh. sometimes MVP's says also 'nothing'. i cant figure out how it
happens.
Nov 17 '05 #7
Thanks this worked for me :)

"Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
news:On**************@TK2MSFTNGP12.phx.gbl...
All web controls inherit from System.Web.UI.Control which has a property
called 'Controls' this is container of controls hosted by the current
control so you can do the following if you had a Panel control on your
aspx page:

...
TextBox myTextBox = new TextBox();
myPanel.Controls.Add(myTextBox);
...

Or since you are displaying information from a database I guess you are
using a DataGrid or Repeater control both of which support header and
footer templates that allow you to add controls as you wish

here is an article on adding controls to the footer of a datagrid

http://www.extremeexperts.com/Net/Ar...stoFooter.aspx

datagrid girl is always a good resource as well:

http://www.datagridgirl.com/default.aspx

HTH

Ollie Riches

"Grant" <gp*****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
I have this table on my form which gets populated with data from my
database at runtime. I would like to place some controls (linkbutton,
textbox etc.) beneath the table when it is complete - at the moment the
controls just stay where I place them and the table gets built on top of
them. I have tried searching the net for a solution but being on dial up
its excruciatingly slow and I havent yet found the answer. Please could
someone point me in the right direction...

I am using c# and asp.net

Thanks,
Grant


Nov 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by ilPostino | last post: by
4 posts views Thread by Harry | last post: by
2 posts views Thread by Vivek Sharma | last post: by
4 posts views Thread by sydney.luu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.