This is not a good idea to load another aspx page inside one div. Each aspx page has viewstate information to maintain the state of the page. If you load one page inside another page. There will be conflict of the viewstate and your page will not work properly.
An easy solution is to have a iframe inside the div and set the iframesource to the new aspx page. Or go for some slient side grid like jqgrid or datatable.net
Thanks & Regards
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
Kamran Akhte...
0 Points
8 Posts
GridView Paging Not Working When Page Is Called via Jquery
Dec 21, 2012 12:56 PM|LINK
I am working with asp.net page which calls another ASPX page containing GridView with paging inside update panel
I call the page via jquery and its loading fine but when I click on Gridview paging, the Grid view disappears
<div id = "divParent">
</div>
<script type = "text/javascript">
$(document).ready(function () {
BindDiv('divParent', 'Parent.aspx');
});
function BindDiv(DivID, url) {
$('#' + DivID).empty();
$('#' + DivID).append('<img src="Images/ajax_loader.gif" alt="Loading..." />');
$.get(url, function (response) {
$('#' + DivID).empty();
$('#' + DivID).append($(response).find('#ParentContainer'));
});
}
</script>
second aspx page code
<div id = "ParentContainer">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers ="true" UpdateMode ="Conditional">
<ContentTemplate>
<asp:GridView ID="gvParent" runat="server" SkinID="gvParent" AutoGenerateColumns="False"
AllowSorting="true" AllowPaging="true" PageSize="10" OnPageIndexChanging="gvParent_PageIndexChanging">
<Columns>
<asp:TemplateField HeaderText="Customer ID" SortExpression="CustomerID">
<ItemTemplate>
<asp:Label ID="lblCustomerID" runat="server" Text='<%# Eval("CustomerID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="First Name" SortExpression="Fname">
<ItemTemplate>
<asp:Label ID="lblFname" runat="server" Text='<%# Eval("Fname") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
plz help
thanks in advance
asteranup
All-Star
30184 Points
4906 Posts
Re: GridView Paging Not Working When Page Is Called via Jquery
Dec 22, 2012 06:53 AM|LINK
Hi,
This is not a good idea to load another aspx page inside one div. Each aspx page has viewstate information to maintain the state of the page. If you load one page inside another page. There will be conflict of the viewstate and your page will not work properly. An easy solution is to have a iframe inside the div and set the iframesource to the new aspx page. Or go for some slient side grid like jqgrid or datatable.net
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog