Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 November 30th, 2004, 03:41 PM
Authorized User
 
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating controls dynamically

Hi-
I need to create hyperlinks dynamically based on the number of records in the database. I tried creating tablerows dynamically and added it to the panel. It loads all the records fine. However the buttons below the panel are overlapped if the number of records increases. How can I move the buttons down. I tried to put them in a separate panel, but still is overlapped by the data in the above panel. I am sure it has to do with relative positioning, but can't figure out if needs to be done in the code or HTML. I need to do this for at least four fields on my form, not necessarily hyperlinks, but load the records from database;they might be in the middle of the form. I that case, all the fields below should move automatically depending on the number of records loaded. Any help on this will be very well appreciated. I have been struggling for the past 2 days. Also, it doesn't let me add the button to the panel dynamically. The error is "Button must be enclosed in the form tags with runat=server"
Thanks


 
Old November 30th, 2004, 03:51 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

How do you add your positioning info to the page?

Do you have the Grid Layout enabled? If so, you may want to turn that off (that's a good idea anyway).

Then you could generate a dynamic table, and add the links to the cell. Alternatively you could create a bulleted list and add items to it. It all depends on your requirements....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Warning Sign by Coldplay (From the album: A Rush Of Blood To The Head) What's This?
 
Old November 30th, 2004, 03:57 PM
Authorized User
 
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar for such a quick response. I have form's positioning as "Gridlayout", I tried it to change it to "Flowlayout", but still it does not work. Is there any way I can set the Panels' layout?

 
Old November 30th, 2004, 04:11 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If you turn off grid layout at a later stage, the damage has already been done. There will be loads of relative position stuff on your page already.

I think you'll need to start with a fresh ASPX page (you can leave the Code Behind as is), or manually remove all the CSS crap that VS.NET has added....

AFAIK, a Panel doesn't render much output, so it shouldn't affect positioning. If you want, you can also use a Placeholder which renders no output at all.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Up Jumped the Devil by Nick Cave and the Bad Seeds (Track 2 from the album: Tender Prey) What's This?
 
Old December 1st, 2004, 11:20 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The panel control renders a DIV (in 'div' capable browsers) which may have positioning information.
 
Old December 6th, 2004, 05:22 PM
Authorized User
 
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I have to redo my form, what is the best way to do it.
I have at least 4 such fields on my page that will grow or shrink based on the number of records in the file. They can be anywhere in the middle of the form. In that case, everything below it should move down automatically based on the number of records in the file.

OR

Another option is to use datagrid and define the page size, so that scroll bar is automatically added when number of records exceed the page. In that case, the control will occupy the same space no matter how many records are displayed.

Please advise

Thanks a lot for your help.


 
Old December 11th, 2004, 07:24 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Sorry for the late response. Somehow I overlooked this message.

Anyway, I think it doesn't really matter what you use, as long as you don't use the Grid Layout.

Take a look at this current page; it uses flow layout, where each HTML object "flows" after the previous element. So, even if there were 20 posts in this thread, the Snitz logo and Terms of Service would still e at the bottom of the screen because they flow after the rest of the content.

How you display your page depends on what you want, and what your users want. Apparently, Wrox decided to split the page after each XX records, to avoid very long pages. When there are more than XX records (don't know the exact number), a Next Page link appears.
However, even before that, a scroll bar appears when the page is taller than can be displayed on one screen.

So basically, you can choose between long pages, scrolling (even with a separate scrolling element, like a <div>) or you can split the content over multiple pages.

If you need more info how to implement specific behaviors, let me know.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 13th, 2004, 01:19 PM
Authorized User
 
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar. I get the idea, but if I use the flow layout, then I cannot position my controls whereever I want, they will always flow one after each. Does that mean I should be using tables and/or panels etc. How do I achieve flowlayout as well as full control over placing the controls on the web page. Please advice.
Thanks a lot for looking into this.


 
Old December 19th, 2004, 01:43 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Flow layout allows the content of your pages to be more flexible but it doesn't eliminate the capability to position controls. Just about any web site can serve as an example of how to code you HTML in order to lay out a page. A primary tool will be tables as you have guessed. Take a look at the HTML source of virtually any web page and you'll see extensive use of tables for creating page layouts.
 
Old December 19th, 2004, 10:21 AM
Authorized User
 
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Planoie.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help me about dynamically created controls vingo_mail ASP.NET 2.0 Basics 1 March 24th, 2008 12:54 PM
Adding Controls Dynamically andyj00 C# 0 March 19th, 2007 08:54 AM
dynamically creating controls rahulpokharna C# 1 January 11th, 2006 12:47 PM
Dynamically created controls katsarosj ASP.NET 1.0 and 1.1 Basics 4 February 4th, 2004 09:13 PM





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