需要澄清ASP.Net网站中的页面浏览量 [英] Need clarification about Page Views count in an ASP.Net site

查看:76
本文介绍了需要澄清ASP.Net网站中的页面浏览量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要澄清有关网站的页面浏览量"的信息.我有一个ASP.Net MVC应用程序,并且在页面中有一个GridView,该页面已启用分页并包含10个页面.

因此,每当用户导航到GridView的不同页面时,页面浏览量"就会增加还是仅当用户导航到其他页面时才会增加?

另外,当我们从网站下载图像,pdf,word或任何其他文档时,页面浏览量"计数也会增加吗?

请清楚解释.

在此先感谢

I need some clarification regarding the Page Views count of a site. I have a ASP.Net MVC application and there is a GridView in a page which has paging enabled and contains 10 pages.

So, whenever the user navigates to different pages of the GridView the Page Views count will get increased or it will get increased only when the user navigates to some other page?

Also, the Page Views count will get increased when we download images, pdf, word or any other documents from the site?

Please explain clearly.

Thanks in advance

推荐答案

这是一个示例,您可以通过该示例显示带有分页的网格. 以下代码适用于aspx页面:
here is an example through which you can show grid with paging..
Below code is for aspx page:
<asp:DataGrid ID="dgadvetise" runat="server" AutoGenerateColumns="False"





                        onpageindexchanged="dgadvetise_PageIndexChanged"



                        PageSize="5" AllowPaging="True" AllowSorting="True" DataKeyField="ID">
                        <PagerStyle HorizontalAlign="Center" Mode="NumericPages"

                         Position="TopAndBottom"/>

                    <Columns>
                            <asp:BoundColumn DataField="ID" HeaderText="Image ID" Visible="False" />
                            <asp:BoundColumn DataField="Name" HeaderText="Name" />
                            <asp:BoundColumn DataField="Link" HeaderText="Link" />
                            <asp:TemplateColumn HeaderText="Image">
                                <ItemTemplate>
                                    <ul class="hoverbox">
                                        <li>
                                            <a href="#"><img id="imgSmall" src='Picture/<%# DataBinder.Eval(Container, "DataItem.ImagePath") %>' alt="Gallery Image" width="100" height="100" /></a>
                                        </li>
                                    </ul>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:FileUpload ID="flUploadGrid" runat="server" ForeColor="#2A2F0F"></asp:FileUpload>
                                </EditItemTemplate>
                                <HeaderStyle Width="110px" />
                            </asp:TemplateColumn>
                            <asp:EditCommandColumn CancelText="Cancel" EditText="Edit" HeaderText="Modify" UpdateText="Update"/>
                            <asp:ButtonColumn CommandName="Delete" Text="Delete" HeaderText="Remove"/>
                        </Columns>
                    </asp:DataGrid>
                    <asp:SqlDataSource ID="nayumaadminconnectionstring" runat="server"

                        ConnectionString="<%


ConnectionStrings:nayumaConnectionString SelectCommand =" > < /asp:SqlDataSource >
ConnectionStrings:nayumaConnectionString %>" SelectCommand="SELECT * FROM [Details]"></asp:SqlDataSource>


CS页面代码是:


And the cs page code is:

protected void dgadvetise_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
    {
        dgadvetise.CurrentPageIndex = e.NewPageIndex;

        BindGrid();
    }
protected void BindGrid()
    {
        cls.PopulateGrid(dgadvetise, "Select ID, Name, Link, ImagePath from Details order by ID", this.Page);
    }


我正在使用下面提到的通用类:


I am using a common class which is mentioned below:

public void PopulateGrid(GridView grdView, string sqlQuery, Page form)
    {
        try
        {
            adp = new SqlDataAdapter(sqlQuery, conn);
            tbl = new DataTable();
            adp.Fill(tbl);
            grdView.DataSource = tbl;
            grdView.DataBind();
        }
        catch (Exception ex)
        {
            MsgBox("Populate GridView Error: " + ex.Message, form);
        }
    }


注意:在类文件中指定您的连接.

希望以上代码对您有所帮助.


NB: specify your connection in the class file.

I hope this above code will help you.


这篇关于需要澄清ASP.Net网站中的页面浏览量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆