Replies
Hello ygalanter,
There is no feature in WHDG for Parent & Child level custom paging based on query selection(dataSet).
I have request to new feature release as :
"In the grid show paging by a specified record count and page size. Upon loading the paging numbers will show initially. Once the page number is clicked then a query can be executed to return by the specified page. This would allow the database to only query what records will show on the grid by a page selected. (Include Parent & Child grid also…)".
Let's us wait for a new feature release.
Warm & Best Regards,
Raja S.
Hi Lyuba,
May I please let me know which is the latest service release it will work???
Urgent !!!!
Warm & Best Regards,
Raja S
I am using three level Hierarchical binding So how i need rebind each of every level page load dataSet. now i am using below the Page_Load code even i am getting issues.
So Do you have any idea about this each level dataSet rebind
My Page Load Code below:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
else
{
if (Cache["PRECEPTORS_MAIN"] != null)
{
this.WebHierarchicalDataGrid1.DataSource = Cache["PRECEPTORS_MAIN"];
}
foreach (ContainerGridRecord BandLevelFirstRow in WebHierarchicalDataGrid1.GridView.Rows)
{
if (BandLevelFirstRow.RowIslands.Count > 0)
{
if (((ContainerGrid)BandLevelFirstRow.RowIslands[0]).Key == "NPS_MAIN")
{
if (Cache["NP_MAIN"] != null)
((ContainerGrid)BandLevelFirstRow.RowIslands[0]).DataSource = Cache["NP_MAIN"];
foreach (ContainerGridRecord BandLevelSecondRow in ((ContainerGrid)BandLevelFirstRow.RowIslands[0]).Rows)
{
if (BandLevelSecondRow.RowIslands.Count > 0)
{
if (((ContainerGrid)BandLevelSecondRow.RowIslands[0]).Key == "MEMBERS_MAIN")
{
if (Cache["MEMBERS_MAIN"] != null)
((ContainerGrid)BandLevelSecondRow.RowIslands[0]).DataSource = Cache["MEMBERS_MAIN"];
}
}
}
}
}
}
}
}
Please help me urgent !!!!!!!. becuase we have 10000 records for second level and third level binding, So we need implement custom paging sever event.
Is this WHDG really useful for Hierarchical Data binding three level and paging?
Warm & Best Regards,
Raja S
Hi Ygalanter,
Do you have any sample code child band level paging ????
Warm & Best Regards,
Raja S
Hi,
If i am using this manul load on demand child level paging, i am getting error: "Microsoft JScript runtime error: 'Sys.Res.argumentDomElement' is null or not an object"
public void Paging_PageIndexChanged(object sender, PagingEventArgs e)
{
int oldPageIndex = e.OldPageIndex;
int currentIndexPage = ((ContainerGrid)sender).Behaviors.Paging.PageIndex;
}
Do you have any idea!
Warm & Best Regards,
Raja S
yes, i have done parent level every postback rebind gird, but i have do child gird (ContainerGrid) level also????
Please find the below of my code(ASPX with CS Code).
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="whdg_New.aspx.cs" Inherits="whdg_New" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>WHDG Test Page</title>
<script type="text/javascript" language="javascript">
function IndexChanged() {
debugger;
var dropdownlist = document.getElementById("WebHierarchicalDataGrid1_ctl00_2_0_ctl00_DropDownList1");
var grid = $find("WebHierarchicalDataGrid1");
var gridView=grid.get_gridView();
var rows =null;
if(gridView !=null)
rows = gridView.get_rows();
if (rows !=null && rows.get_row != null && rows.get_row.length > 0)
{
var childGridView = rows.get_row(1).get_rowIslands()[0];
childGridView.get_behaviors().get_paging().get_pageIndex() + 1;
if(childGridView != null)
{
var newValue = dropdownlist.selectedIndex;
childGridView.get_behaviors().get_paging().set_pageIndex(newValue);
}
}
}
function PreviousPage() {
debugger;
var grid = $find("WebHierarchicalDataGrid1");
var dropdownlist = document.getElementById("WebHierarchicalDataGrid1_ctl00_2_0_ctl00_DropDownList1");
var gridView=grid.get_gridView();
var rows =null;
if(gridView !=null)
rows = gridView.get_rows();
if (rows !=null && rows.get_row != null && rows.get_row.length > 0)
{
var childGridView = rows.get_row(1).get_rowIslands()[0];
childGridView.get_behaviors().get_paging().get_pageIndex() + 1;
if(childGridView != null)
{
if( childGridView.get_behaviors().get_paging().get_pageIndex() > 0 ) {
childGridView.get_behaviors().get_paging().set_pageIndex(childGridView.get_behaviors().get_paging().get_pageIndex() – 1);
}
}
}
}
function NextPage() {
var grid = $find("WebHierarchicalDataGrid1");
debugger;
var dropdownlist = document.getElementById("WebHierarchicalDataGrid1_ctl00_2_0_ctl00_DropDownList1");
var gridView=grid.get_gridView();
var rows =null;
if(gridView !=null)
rows = gridView.get_rows();
if (rows !=null && rows.get_row != null && rows.get_row.length > 0)
{
var childGridView = rows.get_row(1).get_rowIslands()[0];
childGridView.get_behaviors().get_paging().get_pageIndex() + 1;
if(childGridView != null)
{
if(childGridView.get_behaviors().get_paging().get_pageIndex() < childGridView.get_behaviors().get_paging().get_pageCount() – 1) {
childGridView.get_behaviors().get_paging().set_pageIndex(childGridView.get_behaviors().get_paging().get_pageIndex() + 1);
}
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<ig:WebScriptManager ID="WebScriptManager1" runat="server" AsyncPostBackTimeout="100000" >
</ig:WebScriptManager>
<br />
<br />
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server"
AutoGenerateColumns="False" AutoGenerateBands="False" DataKeyFields="Pre_Main_ID"
InitialDataBindDepth="0"
Height="627px"
Width="90%"
OnRowIslandsPopulating="WebHierarchicalDataGrid1_RowIslandsPopulating"
OnInitializeRow="WebHierarchicalDataGrid1_InitializeRow" >
<ExpandCollapseAnimation SlideOpenDuration="300"
SlideCloseDuration="300" />
<AjaxIndicator Enabled="True" BlockArea="Control" BlockCssClass="ig_AjaxIndicatorBlock" />
<Columns>
<ig:BoundDataField DataFieldName="Pre_Main_ID" Hidden="True" Key="Pre_Main_ID">
<Header Text="Pre_Main_ID" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Month" Key="Month">
<Header Text="Month" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="CompletedHouseCalls" Key="CompletedHouseCalls">
<Header Text="Completed House Calls" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Reviewed" Key="Reviewed">
<Header Text="Reviewed" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Reviewed_Pre" Key="Reviewed_Pre">
<Header Text="Reviewed%" />
</ig:BoundDataField>
<ig:TemplateDataField Key="GenerateInvoice">
<ItemTemplate>
<asp:Button Text="Generate Invoice" runat="server" />
</ItemTemplate>
</ig:TemplateDataField>
</Columns>
<Bands>
<ig:Band AutoGenerateColumns="False" DataKeyFields="NP_Main_ID" >
<Columns>
<ig:BoundDataField DataFieldName="NP_Main_ID" Hidden="True" Key="NP_Main_ID">
<Header Text="NP_Main_ID" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Pre_Main_Ref" Hidden="True" Key="Pre_Main_Ref">
<Header Text="Pre_Main_Ref" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="NP_Name" Key="NP_Name">
<Header Text="NP" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Completed_Number" Key="Completed_Number">
<Header Text="Completed" />
</ig:BoundDataField>
<ig:TemplateDataField Key="Reviewed">
<ItemTemplate>
<!–<asp:HyperLink ID="hprlink" runat="server" Font-Bold="true" ForeColor="blue"><%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Reviewed") %></asp:HyperLink> –>
<asp:Label ID="Label1" runat="server"><%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Reviewed") %></asp:Label>
</ItemTemplate>
<Header Text="Reviewed" />
</ig:TemplateDataField>
</Columns>
<Bands>
<ig:Band AutoGenerateColumns="False" DataKeyFields="Member_ID" >
<Columns>
<ig:BoundDataField DataFieldName="Member_ID" Hidden="True" Key="Member_ID">
<Header Text="Member_ID" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="NP_Main_Ref" Hidden="True" Key="NP_Main_Ref">
<Header Text="NP_Main_Ref" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="MemberName" Key="MemberName">
<Header Text="MemberName" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="AssessmentDate" Key="AssessmentDate">
<Header Text="AssessmentDate" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="County" Key="County">
<Header Text="County" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="ReviewStatus" Key="ReviewStatus">
<Header Text="Reviewed" />
</ig:BoundDataField>
<ig:TemplateDataField Key="IsReview">
<ItemTemplate>
<asp:HyperLink ID="hprlink" runat="server" NavigateUrl="#"
Font-Bold="true" ForeColor="blue"><%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "IsReview")%>
</asp:HyperLink>
</ItemTemplate>
</ig:TemplateDataField>
</Columns>
</ig:Band>
</Bands>
</ig:Band>
</Bands>
</ig:WebHierarchicalDataGrid>
</div>
</form>
</body>
</html>
Code Behind
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Infragistics.Web.UI.GridControls;
using Infragistics.Web.UI.DataSourceControls;
public partial class whdg_New : System.Web.UI.Page
{
ContainerGrid childGrid = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
else
{
this.WebHierarchicalDataGrid1.DataSource = Cache["PRECEPTORS_MAIN"];
}
}
protected void WebHierarchicalDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
{
string key = string.Empty;
key = e.Row.DataKey[0].ToString();
if ((((ContainerGridRecord)e.Row)).Level == 0)
{
DataRow[] drSelectedRow = ((DataSet)Cache["PRECEPTORS_MAIN"]).Tables[1].Select(" [Pre_Main_Ref] = " + key.ToString());
if (drSelectedRow != null && drSelectedRow.Length > 0)
{
((ContainerGridRecord)e.Row).IsEmptyParent = true;
}
}
if ((((ContainerGridRecord)e.Row)).Level == 1)
{
DataRow[] drSelectedRow = ((DataSet)Cache["NP_MAIN"]).Tables[1].Select(" [NP_Main_ref] = " + key.ToString());
if (drSelectedRow != null && drSelectedRow.Length > 0)
{
((ContainerGridRecord)e.Row).IsEmptyParent = true;
}
}
}
protected void WebHierarchicalDataGrid1_RowIslandsPopulating(object sender, Infragistics.Web.UI.GridControls.ContainerRowCancelEventArgs e)
{
//Cancel the default automatic load on demand operation
e.Cancel = true;
switch (e.Row.Level)
{
case 0:
if (e.Row.RowIslands.Count == 0)
{
BindSecondLevel(e);
}
break;
case 1:
if (e.Row.RowIslands.Count == 0)
{
BindThirdLevel(e);
}
break;
}
}
private void BindGrid()
{
SqlParameter[] spParameters = new SqlParameter[3];
SqlParameter sqlpar = null;
sqlpar = new SqlParameter("@Pre_Main_Ref","");
spParameters[0] = sqlpar;
sqlpar = new SqlParameter("@NP_Main_Ref", "");
spParameters[1] = sqlpar;
sqlpar = new SqlParameter("@mode", "0");
spParameters[2] = sqlpar;
DataSet ds = new DataSet("PRECEPTORS_MAIN");
DBConnection.retrieveEHouseCallDetails("Select_Main_SP", ref ds, System.Data.CommandType.StoredProcedure, spParameters);
ds.Tables[0].TableName = "PRECEPTORS_MAIN";
ds.Tables[1].TableName = "NPS_MAIN_IDs";
Cache["PRECEPTORS_MAIN"] = ds;
WebHierarchicalDataGrid1.DataSource = ds;
}
private void BindSecondLevel(Infragistics.Web.UI.GridControls.ContainerRowCancelEventArgs e)
{
// Create Container Grid
childGrid = new ContainerGrid();
// Get the data key
string Key = e.Row.DataKey[0].ToString();
SqlParameter[] spParameters = new SqlParameter[3];
SqlParameter sqlpar = null;
sqlpar = new SqlParameter("@Pre_Main_Ref", Key);
spParameters[0] = sqlpar;
sqlpar = new SqlParameter("@NP_Main_Ref", null);
spParameters[1] = sqlpar;
sqlpar = new SqlParameter("@mode", "1");
spParameters[2] = sqlpar;
DataSet dsChild = new DataSet("NPS_MAIN");
DBConnection.retrieveEHouseCallDetails("Select_Main_SP", ref dsChild, System.Data.CommandType.StoredProcedure, spParameters);
dsChild.Tables[0].TableName = "NPS_MAIN";
dsChild.Tables[1].TableName = "MEMBERS_MAIN";
Cache["NP_MAIN"] = dsChild;
if (dsChild != null && dsChild.Tables[0].Rows.Count > 0)
{
// Bind Grid
e.Row.RowIslands.Add(childGrid);
childGrid.Level = 1;
childGrid.DataSource = dsChild;
childGrid.Band = (Band)WebHierarchicalDataGrid1.Bands[0];
childGrid.Behaviors.CreateBehavior<Paging>();
childGrid.Behaviors.Paging.Enabled = true;
childGrid.Behaviors.Paging.PageIndex = 0;
childGrid.Behaviors.Paging.PageSize = 2;
//childGrid.Behaviors.Paging.PagerTemplate = new CustomPagerTemplate();
childGrid.PageIndexChanged += new PageIndexChangedHandler(childGrid_PageIndexChanged);
}
}
void childGrid_PageIndexChanged(object sender, PagingEventArgs e)
{
//throw new Exception("The method or operation is not implemented.");
}
private void BindThirdLevel(Infragistics.Web.UI.GridControls.ContainerRowCancelEventArgs e)
{
// Create Container Grid
childGrid = new ContainerGrid();
// Get the data key
string Key = e.Row.DataKey[0].ToString();
SqlParameter[] spParameters = new SqlParameter[3];
SqlParameter sqlpar = null;
sqlpar = new SqlParameter("@Pre_Main_Ref", null);
spParameters[0] = sqlpar;
sqlpar = new SqlParameter("@NP_Main_Ref", Key);
spParameters[1] = sqlpar;
sqlpar = new SqlParameter("@mode", "2");
spParameters[2] = sqlpar;
DataSet dsChild = new DataSet();
DBConnection.retrieveEHouseCallDetails("Select_Main_SP", ref dsChild, System.Data.CommandType.StoredProcedure, spParameters);
dsChild.Tables[0].TableName = "MEMBERS_MAIN";
if (dsChild != null && dsChild.Tables[0].Rows.Count > 0)
{
e.Row.RowIslands.Add(childGrid);
// Bind Grid
childGrid.Level = 2;
childGrid.DataSource = dsChild;
childGrid.Band = (Band)WebHierarchicalDataGrid1.Bands[0].Bands[0];
}
}
}
Please help me urgent!!!!!
Warm & Best Regards,
Raja S