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 30th, 2005, 09:07 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default Moving controls at run time

I have a grid at the top of a page where the user can enter data into this as needed, however I have only left enough room for four lines as this is the usual amount of records, however on rare occasion there may be as many as eight, I do not want to leave room for eight rows as this is a large amount of space being wasted for these rare occasions. On these occasions where the gird does go to eight rows some of the other controls get covered with the grid. I therefore need a way in which I can move the other controls depending upon how many rows there are on the grid. How can I reset the position of controls at run time?

Thanks

Louisa

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

I see 2 options for you
1. Place a DIV tag around your grid and set overflow. Then set the size of the div. You will get scrollbars if the grid length exceeds the div size.

2. Create a page using FlowLayout. The controls below the grid will be pushed down as the grid size increases. I suggest using a table for layout if you choose this option.

 
Old July 1st, 2005, 05:34 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry you lost me a bit, the flow layout sound exactly what I am trying to do, but how do I achieve this?

 
Old July 1st, 2005, 07:50 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The body tag has an attribute used ONLY by visual studio.net: "MS_POSITIONING". This attribute will contain the value "GridLayout" in a new page with a default web project configuration. You can change this to "FlowLayout" so that new controls on the page get added without positioning information.

The key with changing it mid-design is that all the existing control will retain their positioning attributes and will still be explicitly positioned. You need to remove the positioning information from the controls in order for them to "Flow". The positioning info is usually in the "style" attribute of the controls.

-Peter
 
Old July 4th, 2005, 10:27 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Peter I now understand, but every time I take out the style info and put in nothing or flow, the control appears in the top left of the page and still doesn't flow, any ideas?

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

You will have to use a table or CSS to posititon the controls with FlowLayout

 
Old July 5th, 2005, 02:49 AM
Authorized User
 
Join Date: Dec 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Protected Sub DataGrid_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
        ' First, make sure we're NOT dealing with a Header or Footer row
                If e.Item.ItemType = ListItemType.Footer Then
'This example is for increasing colspan for footer where I have 8 columns but i dont want all of them to be shown
            ' e.Item.Cells(4).ColumnSpan = 4




            'Remove the two right cells
            e.Item.Cells.RemoveAt(8)
             e.Item.Cells.RemoveAt(7)
            e.Item.Cells.RemoveAt(6)
            'e.Item.Cells.RemoveAt(5)
            'e.Item.Cells.RemoveAt(4)
            'e.Item.Cells.RemoveAt(3)
            'e.Item.Cells.RemoveAt(2)
            ' e.Item.Cells.RemoveAt(1)
            ' e.Item.Cells.RemoveAt(0)

            'Align the cell to the left, make its text bold, and set
            'its background color
            ' e.Item.Cells(0).Attributes.Add("align", "Left")
            'e.Item.Cells(0).Font.Bold = True
            ' e.Item.BackColor = Color.FromArgb(204, 204, 255)


        End If
    End Sub

bdl
 
Old July 7th, 2005, 04:59 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is it possible I could just move the controls using the X and Y co-ordinates.How do I find out the X and Y co-ordinates of controls?

Thanks

Louisa

 
Old July 7th, 2005, 08:47 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can, but this is not a good idea. The control position will still change based screen resolution, sizing of the browser window, and if the user changes text size on the browser.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Controls At Run-Time robbev567 ASP.NET 2.0 Basics 2 July 25th, 2007 04:57 AM
Creating run time controls, manish_kaushik ASP.NET 2.0 Basics 1 February 10th, 2007 04:11 PM
Create Controls in Run Time Fredu Access 3 January 8th, 2005 10:03 AM
Copying controls at run time aspadda Excel VBA 0 November 12th, 2003 01:07 PM
Adding controls at run-time !! kishore_peddi C# 0 October 13th, 2003 06:52 AM





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