Asp.net uses Div Fixed Header + asynchronous display for Dynamic Loading

Source: Internet
Author: User

During the development process, some queries are often made, such as selecting conditions at the top of the page, and the query results are displayed below.
If there are too many query results, the scroll bar on the right of the page starts to work. As a result, when you view the following query results, the selection of conditions is invisible (dragged beyond the visible range above)
A simple Div can prevent this situation.
Site.css:

  1. . Divfix
  2. {
  3. Height: 200px;
  4. Width: 100%;
  5. Overflow: Scroll;
  6. Position: absolute;
  7. }
  8. Th {Z-INDEX: 49; top: expression (this. offsetparent. scrollTop-1); position: relative ;}

HTML:

  1. <HTML xmlns = "http://www.w3.org/1999/xhtml">
  2. <Head runat = "server">
  3. <Title> untitled page </title>
  4. <Link id = "link1" type = "text/CSS" href = "site.css" runat = "server" rel = "stylesheet"/>
  5. <SCRIPT type = "text/JavaScript">
  6. Function show ()
  7. {
  8. Document. getelementbyid ("mydiv"). style. Display = "Block ";
  9. }
  10. </SCRIPT>
  11. </Head>
  12. <Body>
  13. <Form ID = "form1" runat = "server">
  14. <Asp: scriptmanager id = "scriptmanager1" runat = "server"/>
  15. <Asp: button id = "button1" runat = "server" onclientclick = "show ()" onclick = "button#click" text = "button"/>
  16. <Div>
  17. <Asp: updatepanel id = "updatepanel1" runat = "server">
  18. <Contenttemplate>
  19. <Div id = "mydiv" runat = "server" style = "display: none; left: 50%">
  20. </Div>
  21. <Div class = "divfix">
  22. <Asp: gridview id = "gvshow" runat = "server" autogeneratecolumns = "false"
  23. Width = "881px" Height = "270px" cellpadding = "4" forecolor = "#333333">
  24. <Columns>
  25. <Asp: templatefield>
  26. <Itemtemplate>
  27. <Asp: button id = "btnedit" runat = "server" text = "modify" commandname = "modify"/>
  28. </Itemtemplate>
  29. </ASP: templatefield>
  30. <Asp: templatefield>
  31. <Itemtemplate>
  32. <Asp: button id = "btndel" runat = "server" text = "delete" commandname = "Del"/>
  33. </Itemtemplate>
  34. </ASP: templatefield>
  35. <Asp: boundfield datafield = "ID" headertext = "ID"/>
  36. <Asp: boundfield datafield = "name" headertext = "name"/>
  37. </Columns>
  38. </ASP: gridview>
  39. </Div>
  40. </Contenttemplate>
  41. <Triggers>
  42. <Asp: asyncpostbacktrigger controlid = "button1" eventname = "click"/>
  43. </Triggers>
  44. </ASP: updatepanel>
  45. </Div>
  46. </Form>
  47. </Body>

Note:
1. When Div mydiv is used for asynchronous jobs, dynamic information (such as a dynamic image) is displayed)

2. If mydiv is not displayed at the beginning, click "button. After the event is completed, mydiv returns to the initial state due to the sending-back mechanism: invisible

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.