Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   Dynamically placing controls/ page items at runtime (http://www.velocityreviews.com/forums/t758000-dynamically-placing-controls-page-items-at-runtime.html)

The Crow 10-26-2005 06:01 AM

Re: Dynamically placing controls/ page items at runtime
 
placing runat="server" to the table and and something like ,
table.Rows[4].Cells[3].Controls.Add(lnkButton); , will work.



chris 10-26-2005 07:32 AM

Re: Dynamically placing controls/ page items at runtime
 

"Grant" <gpsnett@hotmail.com> wrote in message
news:%23sRqxDf2FHA.472@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
>




Grant 10-26-2005 07:48 AM

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



Ollie Riches 10-26-2005 09:30 AM

Re: Dynamically placing controls/ page items at runtime
 
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" <gpsnett@hotmail.com> wrote in message
news:%23sRqxDf2FHA.472@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
>




J. Merrill 10-26-2005 03:47 PM

Re: Dynamically placing controls/ page items at runtime
 
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" <gpsnett@hotmail.com> wrote in message
> news:%23sRqxDf2FHA.472@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
> >

>
>
>


Ollie Riches 10-26-2005 04:22 PM

Re: Dynamically placing controls/ page items at runtime
 
say nothing...

"J. Merrill" <jvm_cop+msdnng@spamcop.net.nospam> wrote in message
news:D0DFEB5F-C735-4720-89CA-896A51E342D9@microsoft.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" <gpsnett@hotmail.com> wrote in message
>> news:%23sRqxDf2FHA.472@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
>> >

>>
>>
>>




The Crow 10-26-2005 09:32 PM

Re: Dynamically placing controls/ page items at runtime
 
ehhehegh. sometimes MVP's says also 'nothing'. i cant figure out how it
happens.



Grant 10-31-2005 11:29 AM

Re: Dynamically placing controls/ page items at runtime
 
Thanks this worked for me :)

"Ollie Riches" <ollie.riches@phoneanalyser.net> wrote in message
news:On$jz9g2FHA.2364@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" <gpsnett@hotmail.com> wrote in message
> news:%23sRqxDf2FHA.472@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
>>

>
>





All times are GMT. The time now is 10:51 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.