Hi All,
I'm having some issues building a RadGrid using Advanced Data Binding. I have a grid that is displaying a report that's run by selection options and clicking a button. When the button is clicked the first page generates correctly, but any time you try to use any of the paging (click page number, forward, back) the DataSourse appears to be wiped out and the grid becomes invisible again since it is empty. Any help would be appreciated.
Grid:
OnNeedDataSource:
On Button Click:
I'm having some issues building a RadGrid using Advanced Data Binding. I have a grid that is displaying a report that's run by selection options and clicking a button. When the button is clicked the first page generates correctly, but any time you try to use any of the paging (click page number, forward, back) the DataSourse appears to be wiped out and the grid becomes invisible again since it is empty. Any help would be appreciated.
Grid:
<
telerik:RadGrid
ID
=
"GridComplianceReport"
Width
=
"100%"
AllowPaging
=
"True"
PageSize
=
"30"
runat
=
"server"
AllowSorting
=
"true"
Visible
=
"false"
OnNeedDataSource
=
"GridComplianceReport_NeedDataSource"
GridLines
=
"None"
>
<
MasterTableView
Width
=
"100%"
/>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
</
telerik:RadGrid
>
OnNeedDataSource:
protected void GridComplianceReport_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
Employee parentEmployee = new Employee();
Employee childEmployee = new Employee();
if (Session["Employee"] != null)
{
parentEmployee = (Employee)Session["Employee"];
}
if (Session["ChildEmployee"] != null)
{
childEmployee = (Employee)Session["ChildEmployee"];
if (Session["SelectedEmployeeID"].ToString() == parentEmployee.EmployeeID)
{
FillComplianceReport(parentEmployee);
}
else
{
FillComplianceReport(childEmployee);
}
}
else //no child employee, populate with logged in employee
{
FillComplianceReport(parentEmployee);
}
}
private void FillComplianceReport(Employee employee)
{
lblReportsHeader.Text = employee.Name;
string who = "";
ArrayList complianceType = new ArrayList();
ArrayList complianceStatus = new ArrayList();
List<
Reports
> complianceReport = new List<
Reports
>();
who = rdbEmployeeType.SelectedItem.Value;
foreach (ListItem item in chkComplianceTypes.Items)
{
if (item.Selected)
complianceType.Add(item.Value);
}
foreach (ListItem item in chkComplianceStatus.Items)
{
if (item.Selected)
complianceStatus.Add(item.Value);
}
complianceReport = EmployeeBLL.GetComplianceReports(employee.EmployeeID, who, complianceType, complianceStatus);
Session["ComplianceReport"] = complianceReport;
GridComplianceReport.DataSource = complianceReport;
if (compliancereport.Count > 0)
GridComplianceReport.Visible = true;
ReportsExceptionPanel.Visible = false;
}
protected void btnGenerateComplianceReport_Click(object sender, ImageClickEventArgs e)
{
GridComplianceReport.Visible = true;
GridComplianceReport.DataSource = null;
GridComplianceReport.Rebind();
}