I got what I thought was a really simple example to test the drilldown capability of the orgchart, but I'm getting an errror:
Sys.WebForms.PageRequestManagerServerErorrException :Object reference not set to an instance of an object.
I get this when I click on the little icon next to someone's name to drill down.
The page comes up fine and displays the chart, so I know there's nothing wrong with the query.
Here's the bare bones code:
Thanks ... Ed
<%@ Page Title="" Language="C#" MasterPageFile="~/Default.master" AutoEventWireup="true" CodeFile="TestOrgChart.aspx.cs" Inherits="SysAdmin_TestOrgChart" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><asp:Content ID="Content1" ContentPlaceHolderID="cntHead" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="cntPageBody" Runat="Server"> <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" > <telerik:RadOrgChart runat="server" ID="org1" EnableDrillDown="true"> </telerik:RadOrgChart></telerik:RadAjaxPanel>using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Telerik.Web.UI;using MyDB;public partial class SysAdmin_TestOrgChart : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadChart(); } } private void LoadChart() { MyDataContext db = new MyDataContext(); var qry = from a in db.STAFFs select new { a.STAFF_SEQ, a.PARENT_STAFF_SEQ, FullName = a.LAST_NAME + ", " + a.FIRST_NAME }; org1.DataSource = qry.ToDataTable(); org1.DataFieldID = "STAFF_SEQ"; org1.DataFieldParentID = "PARENT_STAFF_SEQ"; org1.DataTextField = "FullName"; org1.DataBind(); org1.DisableDefaultImage = true; }} </asp:Content>
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowPaging="True" OnItemCreated="RadGrid1ItemCreated" OnNeedDataSource="RadGrid1NeedDataSource" OnCustomAggregate="RadGrid1CustomAggregate" OnExcelMLExportRowCreated="RadGrid1ExcelMlExportRowCreated" OnExcelMLExportStylesCreated="RadGrid1ExcelMlExportStylesCreated" AllowFilteringByColumn="True" AllowSorting="True" CellSpacing="0" OnItemDataBound="RadGrid1ItemDataBound"> <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"> <Excel Format="ExcelML" /> <Pdf PageTitle="Charity Print-Out" Title="Charity Print-Out" PageHeight="210mm" PageWidth="500mm" DefaultFontFamily="Arial Unicode MS" PageBottomMargin="20mm" PageTopMargin="20mm" PageLeftMargin="20mm" PageRightMargin="20mm" /> </ExportSettings> <PagerStyle Mode="NextPrevAndNumeric" /> <MasterTableView AutoGenerateColumns="False" DataKeyNames="DonationId" CommandItemDisplay="Top" Width="100%" AllowPaging="True" NoDetailRecordsText="" NoMasterRecordsText="" ShowGroupFooter="true" UseAllDataFields="True"> <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="False" ShowRefreshButton="False" ShowExportToPdfButton="True" /> <PagerStyle Mode="NextPrevAndNumeric" /> <Columns> <telerik:GridBoundColumn DataField="CHR_CHARITY_NAME" HeaderText="Charity Name" ReadOnly="True" UniqueName="CHR_CHARITY_NAME" Visible="False" /> <telerik:GridBoundColumn DataField="DonationInternalId" HeaderText="Client Donation ID" ReadOnly="True" UniqueName="DonationInternalId" /> <telerik:GridBoundColumn DataField="DonorName" HeaderText="Donor's Name" ReadOnly="True" UniqueName="DonorName" /> <telerik:GridBoundColumn DataField="DonorAddress" HeaderText="Donor's Address" ReadOnly="True" UniqueName="DonorAddress" /> <telerik:GridBoundColumn DataField="EmailAddress" HeaderText="Email" ReadOnly="True" UniqueName="EmailAddress" /> <telerik:GridBoundColumn DataField="PermissionToContact" HeaderText="Permission To Contact" ReadOnly="True" UniqueName="PermissionToContact" /> <telerik:GridBoundColumn DataField="DateOfDonation" HeaderText="Donation Date" ReadOnly="True" UniqueName="DateOfDonation" /> <telerik:GridBoundColumn DataField="NotesToCharity" HeaderText="Donor Notes" ReadOnly="True" UniqueName="NotesToCharity" /> <telerik:GridBoundColumn DataField="DonationAmount" HeaderText="Donation Amount" ReadOnly="True" UniqueName="DonationAmount" DataFormatString="{0:C}" Aggregate="Custom" FooterText=" " /> </Columns> <GroupByExpressions> <telerik:GridGroupByExpression> <GroupByFields> <telerik:GridGroupByField FieldName="CHR_CHARITY_NAME" /> </GroupByFields> <SelectFields> <telerik:GridGroupByField FieldName="CHR_CHARITY_NAME" HeaderText=" " HeaderValueSeparator=" " /> <telerik:GridGroupByField FieldName="CHR_BN_NUMBER" HeaderText="-" HeaderValueSeparator=" " /> </SelectFields> </telerik:GridGroupByExpression> </GroupByExpressions> </MasterTableView></telerik:RadGrid>protected void RadGrid1CustomAggregate(object sender, GridCustomAggregateEventArgs e){ if (e.Item.DataItem == null) { return; } const string result = "<table style=\"border-collapse:collapse;text-align:left;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" + "<tr><td style=\"text-align:left;\">Total Donations:</td><td>${0}</td></tr>" + "<tr><td style=\"text-align:left;\">Processing & Transaction Fees @ 8%:</td><td>${1}</td></tr>" + "<tr><td style=\"text-align:left;\">Net Donation Amount:</td><td>${2}</td></tr>" + "</table>"; double totalDonations = 0, netDonationAmount = 0, fees = 0; foreach (DataRow row in dataTable.Rows) { if (row["CHR_CHARITY_NAME"].ToString() != ((DataRowView)e.Item.DataItem).Row.ItemArray[0].ToString()) { continue; } if (row["DonationAmount"] != null) { totalDonations += (double)row["DonationAmount"]; } if (row["NetDonationAmount"] != null) { netDonationAmount += (double)row["NetDonationAmount"]; } if (row["Fees"] != null) { fees += (double)row["Fees"]; } } e.Result = String.Format(result, totalDonations.ToString("0.00"), fees.ToString("0.00"), netDonationAmount.ToString("0.00"));}
<
telerik:RadScheduler ID="RadScheduler1" runat="server"
DataDescriptionField="Description" DataEndField="End_Date" DataKeyField="ID"
DataSourceID="SqlDataSource1" DataStartField="Start_Date"
DataSubjectField="Subject" EnableDescriptionField="True">
<ResourceTypes>
<telerik:ResourceType DataSourceID="SqlDataProgramtype"
ForeignKeyField="Programs" KeyField="Programs" Name="Programtype"
TextField="Programs" />
<telerik:ResourceType DataSourceID="SqlDatastaff" ForeignKeyField="Users"
KeyField="Full_Name" Name="Staff" TextField="Full_Name" />
<telerik:ResourceType DataSourceID="SqlDataRooms" ForeignKeyField="ROOMS"
KeyField="ROOMNAME" Name="Rooms" TextField="ROOMNAME" />
</ResourceTypes>
<
WebServiceSettings>
<
ODataSettings InitialContainerName=""></ODataSettings>
</
WebServiceSettings>
</telerik:RadScheduler>

Dim dataItem As GridDataItem = DirectCast(e.Item, GridDataItem)dataItem.GetDataKeyValue("id")function OnCommand(sender, args) { if (args.get_commandName() == "Edit1") { var CommandArg = args.getDataKeyValue("id"); }}