In the ASP. NET video of Beida qingbird, the layout of the page is changed by changing the attribute "pagelayout" to flowlayout (Stream layout) or modifying the attribute "pagelayout" to gridlayout (grid layout. → This is how to set pages in vs2003. In vs2010, The pagelayout attribute is not found! Are you skeptical about the disappearance of pagelayout when using vs2005 or even later? Don't worry. Next I will analyze the pagelayout attribute in a simple way. Thank you very much for your advice!
I. First, we will introduce the pagelayout attribute, which exists in Visual Studio. in NET 2003, due to the cancellation of absolute positioning in later versions such as vs2005, vs2008, and vs2010, the page layout mode supported by default is stream layout page, the pagelayout attribute is no longer used. The following is a brief description of the pagelayout attribute in combination with msdn ......
Introduction to the pagelayout attribute of vs2003 in msdn
The pagelayout attribute sets the element positioning preference of the current HTML document, that is, the page layout model. The values that can be used for this attribute are:
- Gridlayout: the absolute positioning attribute is inserted into the added element and updated in the moving element. You can drag elements on the entire design view. You can use the positioning grid and "Grid line alignment". → absolute positioning, grid layout
- Flowlayout: adds an element without an absolute positioning attribute. The Web browser arranges the elements from top to bottom in the order they appear on the page. You cannot drag elements on the design view surface or use a positioning grid. → Stream Layout
Modify the pagelayout attribute: You can set the pagelayout attribute in the "properties" window or the "Document property page" dialog box. For new HTML pages and web forms created in Visual Basic. Net or Visual C # web applications, the default value of the pagelayout attribute is "gridlayout ". In. net, setting the pagelayout attribute to "gridlayout" inserts the ms_positioning attribute into the <body> element of the HTML document:
<Body ms_positioning = "gridlayout">
|
Resetting the pagelayout property value to "flowlayout" will remove the ms_positioning property: |
For HTML pages and web forms added to "Empty web projects", the default value of the pagelayout attribute is "flowlayout ". when you add an existing HTML document to Visual Studio.. Net solution or project, and its <body> element does not include the ms_positioning = "gridlayout" attribute, the HTML designer opens the document for editing and sets its pagelayout attribute to "flowlayout ". If you set the pagelayout attribute value to gridlayout, you can set the showgrid attribute to true and display the "design" view positioning grid. If "Grid line alignment" is enabled in "display" in the "HTML designer" option dialog box, it is activated. When you release the mouse, the elements that are dragged on the design view are automatically aligned with the nearest positioning grid line. When the HTML element is relocated on the "design" view surface, its positioning attribute is automatically adjusted in the tag. Use the "html" view to slightly adjust the positioning attributes of specific elements.
Note: You can format the tag again when switching the view.
Appendix:Set pagelayout for HTML documents
Attribute
II.Here is a brief analysis of the differences between gridlayout and flowlayout:Gridlayout is absolutely positioned. You can drag and drop any layout on its page, but some controls may be covered by other controls. Flowlayout is quite positioned, and the control layout is difficult. However, it will change its position based on the content and will not cover other controls. The two can be used in combination for layout. I personally do not recommend vs layout. You can use other tools such as DW for layout and import them into vs for use.
3. Like a magic, pagelayout disappears from vs2005 to vs2008 and vs2010. With the upgrade of the version, the software should be based on the purpose of serving the people and without changing people's needs, add new features. Therefore, in Versions later than vs2005, it is possible to drag the control using the original absolute positioning method. How to implement it? Try the following two solutions ......
- Solution 1: Modify the following configurations:
Menu → tool --> Option → HTML designer → CSS style → change the positioning method to absolute positioning (p) for controls added by using toolbox, pasting, or drag-and-drop operations. <
Selected>
- Solution 2: Modify the configuration under the supervisor:
Menu → tools → options → Windows Forms designer → layoutmode attribute set to snaptogrid. Restart Vs and open the project!
How can we design a webpage in whatever way you want? Let's design a beautiful page of your own!