Wrox Programmer Forums
|
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
 
Old June 29th, 2005, 03:00 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default 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

 
Old June 29th, 2005, 03:32 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

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...
 
Old June 29th, 2005, 03:39 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

The application builds a questionair.. there are differnt kinds. So the page actually a user contol adds questins and controls dynamically

 
Old June 29th, 2005, 09:19 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The div tag is just an instance of the HtmlGenericControl class. You can add it like any other control.

-Peter
 
Old June 29th, 2005, 11:41 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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

 
Old June 29th, 2005, 11:49 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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)


 
Old June 29th, 2005, 11:55 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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????

 
Old June 30th, 2005, 12:15 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Nevermind, sorry, I figured it out.
Just added the controls I wanted to the collection of the div.






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to loop through a div tag? Byock Classic ASP Basics 0 December 19th, 2006 02:52 AM
div tag as link Stagmo Dreamweaver (all versions) 0 April 14th, 2006 12:35 AM
stop writing in Div tag Samikaraeen HTML Code Clinic 2 April 9th, 2006 01:29 AM
DIV TAG marclena ASP.NET 1.0 and 1.1 Professional 2 May 24th, 2005 11:14 AM
Referencing a "div" tag in a code behind file. cjo ASP.NET 1.0 and 1.1 Basics 2 December 23rd, 2003 01:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.