Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7634797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:16:17+00:00 2026-05-31T07:16:17+00:00

I have an issue with having a asp.net Grid View loaded into a div

  • 0

I have an issue with having a asp.net Grid View loaded into a div tag on a page (UI/Host.aspx). The Grid View itself is on a seperate page (GridViews/GridView1.aspx) and I’m using the jQuery load() function to load this page into the div tag.

My problem is when sorting the grid view it tries to postback to the page that’s hosting it, and comes back with the error “Unable to find page UI/GridView1.aspx”, is there a way to override this so that it post backs to itself, (which I assumed it would but doesn’t) or is there an easier way to do the sorting.

Is there any other way of doing this, even if it means getting rid of the GridView altogether and using a repeater and table?

Below is the code:

UI/Hosts.aspx


  //jQuery to load the div with the page UI/Hosts.aspx
  $(document).ready(function() {
    StartRefresh();
  });

function startRefresh() { refreshID = setInterval(function() { DisplayDate(); $("#divDests").load("../GridViews/Gridview1.aspx?ConfigID=" + $("#ctl00_MainContent_dlConfiguration").val() + "&ModuleID=" + $("#ctl00_MainContent_ddlModule").val()); }, $("#ctl00_MainContent_ddlRefresh :selected").val()); }

GridViews/Gridview1.aspx;

//Markup for GridViews/Gridview1.aspx
<html>
<head><title></title></head>
<body>

<form runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>


    <br />
    <asp:GridView Font-Size="8.7pt" ID="gvLiveDest" runat="server" AutoGenerateColumns="False" 
        EmptyDataText="No Records Found" AllowSorting="true" 
        onsorting="gvLiveDest_Sorting" onrowcreated="gvLiveDest_RowCreated" OnRowDataBound="gvLiveDest_RowDataBound">
        <Columns>                    
            <asp:TemplateField HeaderText="Name" SortExpression="DestinationName" HeaderStyle-CssClass="centralalignment">
                <ItemTemplate>
                    <asp:Label ID="lblDescription" runat="server" Text='<%# WebHelper.HTMLSafe(Eval("Description")) %>' ToolTip='<%# WebHelper.HTMLSafe(Eval("Description")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Logged &lt;br /&gt; In" HeaderStyle-CssClass="centralalignment" SortExpression="LoggedIn" >
                <ItemStyle CssClass="centralalignment" />
                <ItemTemplate>
                    <asp:Label ID="lblLoggedIn" runat="server" Text='<%# SetLoggedIn(Convert.ToBoolean(Eval("Active"))) %>'></asp:Label>
                 </ItemTemplate>
             </asp:TemplateField>
             <asp:TemplateField HeaderText="Current&lt;br /&gt;Status" HeaderStyle-CssClass="centralalignment" SortExpression="LastStatus" >
                <ItemStyle CssClass="centralalignment" />
                <ItemTemplate>
                    <asp:Label ID="lblCurrentStatus" runat="server" Text='<%# WebHelper.HTMLSafe(Eval("LastStatus")) %>' ToolTip='<%#Eval("LastStatus") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Time in&lt;br /&gt;Current&lt;br /&gt;Status" HeaderStyle-CssClass="centralalignment" SortExpression="CurrentDuration">
                <ItemStyle CssClass="RightAlignment" />
                <ItemTemplate>
                    <asp:Label ID="lblCurrentTime" runat="server" Text='<%# ICT.DAL.Reporting.CallDurFormat(Eval("CurrentDuration")) %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Lines" HeaderText="Lines" HeaderStyle-CssClass="centralalignment" SortExpression="Lines" 
                ItemStyle-CssClass="centralalignment" />
            <asp:BoundField DataField="LinesBusy" HeaderText="Lines &lt;br /&gt; Busy" HeaderStyle-CssClass="centralalignment" 
                ItemStyle-CssClass="centralalignment" ReadOnly="True" HtmlEncode="False" SortExpression="LinesBusy" />
            <asp:BoundField DataField="LinesAvailable" HeaderStyle-CssClass="centralalignment" 
                ItemStyle-CssClass="centralalignment" SortExpression="LinesAvailable" 
                HeaderText="Lines &lt;br /&gt; Available" HtmlEncode="false" ReadOnly="True" />                            
            <asp:TemplateField HeaderText="Last Call Time" SortExpression="Timestamp" HeaderStyle-CssClass="centralalignment">
                <ItemTemplate>
                    <asp:Label ID="lblLastCallTime" runat="server" Text='<%# WebHelper.HTMLSafe(Eval("LastCallTime")) %>' ToolTip='<%# WebHelper.HTMLSafe(Eval("LastCallTime")) %>'></asp:Label>
                 </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

            </ContentTemplate>
    </asp:UpdatePanel>
</form>

</body>
</html>

And the onSort Event Code (However it never hits this)

protected void gvLiveDest_Sorting(object sender, GridViewSortEventArgs e)
{
    if (string.Compare(e.SortExpression, ViewState["SortField"].ToString(), true) == 0)
    {
        _sortDir = (_sortDir == "ASC") ? "DESC" : "ASC";
    }
    else
        _sortDir = "ASC";

    _SortField = e.SortExpression;
    ViewState["SortField"] = e.SortExpression;
    ViewState["sortDir"] = _sortDir;

    BindLiveDestination();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:16:19+00:00Added an answer on May 31, 2026 at 7:16 am

    I switched over to client-side paging/sorting a while ago and haven’t been happier. Of course, you would need to set AllowSorting="false" and AllowPaging="false" in your GridView.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple three page asp.net webforms site and having an issue with
ASP.NET 1.1 - I have a DataGrid on an ASPX page that is databound
I'm having a issue with validations on my aspx page; I have the following
I am having an issue with ColdFusion's CFChart tag. I have a couple graphs
I'm having an issue with my ASP.NET RangeValidator controls. I want to allow users
I having an issue with the ASP.NET Treeview control. I create the treeview just
We're having an issue. We have the majority of our code written in .net
I am a new ASP.NET developer and now I am having an issue in
I'm having an issue with my ASP.Net MVC application, I'm using MVC 3 with
I am using asp.net MVC and I am having an issue posting a form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.