473,466 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2414
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ilPostino | last post by:
ok, so I have my asp.net application. I want a single page which can load asp user controls and at runtime. How can this be done? I don't want to drag the control onto the page because then I...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
4
by: Harry | last post by:
Hello, I have a page with a RadioButtonList and a PlaceHolder control. The RadioButtonList's AutoPostBack attribute is set to TRUE and its SelectedIndexChanged event loads one of three...
1
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a...
4
by: Jordan | last post by:
I need to dynamically add an ImageButton control to a user control and and do some server-side processing when the user clicks it. While I the ImageButton is added to the user control at runtime,...
2
by: Vivek Sharma | last post by:
Hi There, I have a situation where I wish to load the controls dynamically on the basis of user role. Hence, I am using this code. if (UserRole == "IS Administrator") { Control UC1 =...
4
by: jesper_lofgren | last post by:
Hi there, I have some webcontrols that i want to add dynamically on a page. I have stored the path / namespace in database (ex MyNameSpace.WebControls.Control1) to the class/webcontrol. Lets...
4
by: sydney.luu | last post by:
Hello, I would greatly appreciate if someone can show me how to dynamically build a Repeater with unknown number of columns at design time. I have looked various threads in this newsgroup,...
0
by: John Smith | last post by:
I still have not gotten this damn thing figured out and I'm asking for help one last time before I give up on it. I have a user control that contains a paged gridview control. The master page...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.