Update an ASP.Net web page

Asked

Viewed 1,270 times

0

How do I update an ASP.Net web page? I have a page that has two GridView and I need this page updated every 5 minutes.

Mine GridView are like this:

<div class="GridMain">
                    <asp:GridView ID="gvInformationPeriod" runat="server" Width="100%" CssClass="GridViewUser" AllowPaging="True" CellPadding="4" AutoGenerateColumns="False"
                        GridLines="None" ForeColor="#333333" OnPageIndexChanging="gvInformationPeriod_PageIndexChanging" onrowdatabound ="gvInformationPeriod_RowDataBound" PageSize="100">
                        <AlternatingRowStyle CssClass="GridAlternativeUser" BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="PeriodID" HeaderText="PeriodID" />
                            <asp:BoundField DataField="SchoolID" HeaderText="SchoolID" />
                            <asp:BoundField DataField="DateOpen" HeaderText="Aberto Em" />
                            <asp:BoundField DataField="UserName" HeaderText="Usuario" />
                            <asp:BoundField DataField="PCName" HeaderText="PC Name" />
                            <asp:BoundField DataField="Closed" HeaderText="Closed" />
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#62AFC1" CssClass="GridPagerUser" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </div>


<div class="GridMain">
                    <asp:GridView ID="gvInformationProduct" runat="server" Width="100%" CssClass="GridViewUser" AllowPaging="True" CellPadding="4" AutoGenerateColumns="False"
                        GridLines="None" ForeColor="#333333" OnPageIndexChanging="gvInformationProduct_PageIndexChanging" PageSize="100">
                        <AlternatingRowStyle CssClass="GridAlternativeUser" BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="Name" HeaderText="Nome" />
                            <asp:BoundField DataField="Quantity" HeaderText="Quantidade" />
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#62AFC1" CssClass="GridPagerUser" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </div>
  • 1

    you can use ajax in this case, leave the data content of this grid in a specific tag <div class='grid-content'></div> for example and use setTimeInterval(loadDataInGrid(), 5000 * 60);

  • 1

    Use setTimeInterval(loadDataInGrid(), 5000 * 60); within an event?

  • you can use inside the onload event of the page, remembering that loadDataInGrid is a function that you will implement to load the content within the tag you want.

1 answer

1


<meta http-equiv="refresh" content="300; url=http://sua_url.com/">

remembering that the value is in seconds, and how is an html tag works on any browser in any version.

  • Do I need to put this on my master page? Inside the Default.aspx file is not working.

  • the correct is to be between the <head> but if you put in your master page it will be updating all the pages.. Decreases the value of seconds to test. Puts only on the page you want

  • Don’t have something like <Asp:Content ID="Content1" Contentplaceholderid="head" runat="server"> , where do you put the codes for head? in your default.aspx ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.