 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 29th, 2005, 03:00 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Dynamic DIV tag ???
Hello all,
I am creating a form by adding controls dynamically. One of my controls is a DataGrid which has about 20 rows. In the past when not creating the form dynamically, I put the grid inside of a <DIV> tag so that I can have scroll bars to appear. I know the <DIV> tag is HTML, but is there anyway to add it at run time, around my grid, or am I way off here? Thanks for any help and suggestions.
Jim
|
|

June 29th, 2005, 03:32 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Why are you creating the form dynamically, rather than adding information to it dynamically?
You can change the contents of a div on the fly...
|
|

June 29th, 2005, 03:39 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
The application builds a questionair.. there are differnt kinds. So the page actually a user contol adds questins and controls dynamically
|
|

June 29th, 2005, 09:19 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
The div tag is just an instance of the HtmlGenericControl class. You can add it like any other control.
- Peter
|
|

June 29th, 2005, 11:41 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Hey Peter
I noticed this control in my trips through the help files. However it seems, from the examples I have seen, that you have to place the control on the form first before you can access it but I need to add it at run time.
EX.
Me.Controls.Add( Add some controls here)
I want to add the DIV here (Me.Controls.Add( <DIV>) ??????
Me.Controls.Add( new DataGrid)
Add </DIV> here....
Can this be done?
Any help would be great.
Thanks again!!
Jim
|
|

June 29th, 2005, 11:49 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Peter... thanks again for your help. I finally got it!!!
Dim mydiv As System.Web.UI.HtmlControls.HtmlGenericControl
mydiv = New System.Web.UI.HtmlControls.HtmlGenericControl("DIV ")
Me.Controls.Add(mydiv)
|
|

June 29th, 2005, 11:55 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
I just realized on problem however. By adding this code I get <DIV></DIV>
What I need is this
<DIV>
a datagrid here
</DIV>
Any Ideas????
|
|

June 30th, 2005, 12:15 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Nevermind, sorry, I figured it out.
Just added the controls I wanted to the collection of the div.
|
|
 |