<telerik:RadTextBox ID="txtSearch" runat="server" EmptyMessage="Enter First or Last Name..."
Width="145px" Skin="WebBlue">
<PasswordStrengthSettings IndicatorWidth="100px" />
<ClientEvents OnKeyPress="onKeyPressed" />
</telerik:RadTextBox>
function onKeyPressed(sender, args) {
var search = $find("<%= btnSearch.ClientID %>");
//ENTER key pressed on Search
if (args.get_keyCode() == 13) {
alert('Value=' + sender.get_value() + ' Time=' + Date());
alert('Value=' + sender.get_value() + ' Time=' + Date());
search.click();
args.set_cancel(true);
}
}
Dim
idr
As
Data.DataRow
Dim
ids
As
Data.DataSet
Dim
idt
As
Data.DataTable
Dim
idtData
As
New
Data.DataSet
Dim
iParameters(0
To
0)
As
Data.SqlClient.SqlParameter
iParameters(0) =
New
Data.SqlClient.SqlParameter(
"@intBIDOID"
, CheckDBNull(
CInt
(BIDOID), enumObjectType.IntType))
ids = clsEPD_DATA.StoredGetDataset(
"spGetBidsSystemTypeNames"
, iParameters)
If
ids.Tables(0).Rows.Count >= 1
Then
idt = ids.Tables(0)
For
Each
idr
In
idt.Rows
' "BUG" - when one and ONLY one item is check-marked, here, it causes the control to
' be in a state as if SelectedIndex has been changed (Telerik states this is expected).
' And, it stays that way, even though we set it here, and the user did NOT change anything.
' This is a "bug" in our scenario, where I must determine if the USER DID THE CHANGE,
' not the program.
Dim
cboSTObject
As
RadComboBoxItem = cboSystemType.FindItemByValue(CheckDBNull(idr(
"SYSTOID"
), enumObjectType.IntType))
cboSTObject.Checked =
True
cboSTObject.Dispose()
Next
ids.Dispose()
End
If
'------------ end of System Type checkboxed combobox ----------------------
<
telerik:RadComboBox
ID
=
"cboSystemType"
runat
=
"server"
Width
=
"200px"
EmptyMessage
=
"Select the System Type (if any):"
Height
=
"250px"
DataTextField
=
"ST_Name"
DataValueField
=
"SYSTOID"
DataSourceID
=
"SqlDataSource5"
TabIndex
=
"8"
CheckBoxes
=
"True"
CausesValidation
=
"False"
></
telerik:RadComboBox
>
<
br
/>
<
asp:SqlDataSource
ID
=
"SqlDataSource5"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:EPD_DATAConnectionString %>"
SelectCommand="spGetBidSystemTypeNames" SelectCommandType="StoredProcedure">
</
asp:SqlDataSource
>
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"
);
}
}