or
public
class
Spinning
{
public
string
Title {
get
;
set
; }
public
double
Price {
get
;
set
; }
public
int
Quantity {
get
;
set
; }
}
void
RadListBox5_Load()
{
List<Spinning> SpinningList =
new
List<Spinning>
{
new
Spinning { Title =
"Spinning Reel 1"
, Price = 99, Quantity = 1 },
new
Spinning { Title =
"Spinning Reel 2"
, Price = 199, Quantity = 1 }
};
RadListBox5.DataSource = SpinningList;
RadListBox5.DataBind();
}
<
telerik:RadListBox
ID
=
"RadListBox5"
runat
=
"server"
AllowTransfer
=
"true"
AutoPostBackOnTransfer
=
"true"
Height
=
"200px"
OnTransferred
=
"RadListBox5_Transferred"
SelectionMode
=
"Multiple"
TransferToID
=
"RadListBox6"
Width
=
"215px"
>
<
ButtonSettings
ShowTransferAll
=
"false"
VerticalAlign
=
"Middle"
/>
<
ItemTemplate
>
<
table
cellpadding
=
"1"
cellspacing
=
"0"
border
=
"0"
>
<
tr
>
<
td
><
b
><%# DataBinder.Eval(Container, "Attributes['Title']")%></
b
></
td
>
<
td
> [Price:</
td
>
<
td
><%# Convert.ToInt32(DataBinder.Eval(Container, "Attributes['Price']")).ToString("C0") %>]</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadListBox
>
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Telerik.Web.UI;
using
System.Data;
namespace
WebApplication2
{
public
class
Filter : GridTemplateColumn
{
protected
override
void
SetupFilterControls(TableCell cell)
{
RadComboBox filterCombo =
new
RadComboBox();
filterCombo.AutoPostBack =
true
;
filterCombo.DataTextField =
this
.DataField;
filterCombo.DataValueField =
this
.DataField;
filterCombo.SelectedIndexChanged +=
new
RadComboBoxSelectedIndexChangedEventHandler(filterCombo_SelectedIndexChanged);
DataTable dt =
new
DataTable();
dt.Columns.Add(
"ID"
,
typeof
(
int
));
dt.Columns.Add(
"Value"
,
typeof
(
string
));
DataRow row = dt.NewRow();
row[
"ID"
] = 0;
row[
"Value"
] = 0;
dt.Rows.Add(row);
filterCombo.DataSource = dt;
filterCombo.Width =
this
.FilterControlWidth;
filterCombo.NoWrap =
false
;
filterCombo.EmptyMessage =
"No Filter"
;
cell.Controls.Add(filterCombo);
}
private
void
filterCombo_SelectedIndexChanged(
object
sender,
RadComboBoxSelectedIndexChangedEventArgs e)
{
((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent(
"Filter"
,
new
Pair());
}
protected
override
void
SetCurrentFilterValueToControl(TableCell cell)
{
base
.SetCurrentFilterValueToControl(cell);
if
(!(
this
.CurrentFilterValue ==
""
))
{
((RadComboBox)cell.Controls[0]).Items.FindItemByText(
this
.CurrentFilterValue).Selected =
true
;
}
}
protected
override
string
GetCurrentFilterValueFromControl(TableCell cell)
{
string
currentValue = ((RadComboBox)cell.Controls[0]).SelectedItem.Value;
this
.CurrentFilterFunction = (currentValue !=
""
) ? GridKnownFunction.EqualTo : GridKnownFunction.NoFilter;
return
currentValue;
}
}
}
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs"
Inherits="WebApplication2.WebUserControl1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="WebApplication2" Namespace="WebApplication2" TagPrefix="custom" %>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
>
<
MasterTableView
DataKeyNames
=
"ID"
AutoGenerateColumns
=
"false"
AllowFilteringByColumn
=
"True"
>
<
Columns
>
<
custom:Filter
DataField
=
"Value"
HeaderText
=
"Val"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblRiskArea"
Text='<%# Bind("Value")%>' />
</
ItemTemplate
>
</
custom:Filter
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
using
System;
using
System.Data;
namespace
WebApplication2
{
public
partial
class
WebUserControl1 : System.Web.UI.UserControl
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
RadGrid1_NeedDataSource(
object
source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
DataTable dt =
new
DataTable();
dt.Columns.Add(
"ID"
,
typeof
(
int
));
dt.Columns.Add(
"Value"
,
typeof
(
string
));
DataRow row = dt.NewRow();
row[
"ID"
] = 0;
row[
"Value"
] = 0;
dt.Rows.Add(row);
RadGrid1.DataSource = dt;
}
}
}
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
</
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
div
>
</
div
>
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
DataEndField
=
"RotationStart"
DataKeyField
=
"ScheduleID"
DataSourceID
=
"SchedulerDataSource"
DataStartField
=
"RotationStart"
DataSubjectField
=
"FullName"
AllowInsert
=
"False"
GroupBy
=
"ServiceName"
GroupingDirection
=
"Vertical"
Height
=
"600px"
SelectedDate
=
"2010-06-28"
SelectedView
=
"TimelineView"
Skin
=
"Black"
>
<
ResourceTypes
>
<
telerik:ResourceType
DataSourceID
=
"ServiceDataSource"
ForeignKeyField
=
"ServiceID"
KeyField
=
"ServiceID"
Name
=
"ServiceName"
TextField
=
"ServiceName"
/>
</
ResourceTypes
>
<
TimelineView
NumberOfSlots
=
"8"
SlotDuration
=
"7.00:00:00"
/>
</
telerik:RadScheduler
>
<
asp:SqlDataSource
ID
=
"SchedulerDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
DeleteCommand="DELETE FROM Schedule WHERE (ScheduleID = @ScheduleID)" InsertCommand="INSERT INTO Schedule(StudentID, ServiceID, RotationID) VALUES (@StudentID, @ServiceID, @RotationID)"
SelectCommand="SELECT Schedule.ScheduleID, Schedule.StudentID, Schedule.ServiceID, Schedule.RotationID, Rotation.RotationNumber, Rotation.RotationWeek, Rotation.RotationStart, Rotation.RotationEnd, Service.ServiceName, Service.ServiceMax, Student.FullName FROM Rotation INNER JOIN Schedule ON Rotation.RotationID = Schedule.RotationID INNER JOIN Service ON Schedule.ServiceID = Service.ServiceID INNER JOIN Student ON Schedule.StudentID = Student.StudentID"
UpdateCommand="UPDATE Schedule
SET StudentID = @StudentID, ServiceID = @ServiceID, RotationID =
(SELECT RotationID
FROM Rotation
WHERE (RotationStart = @StartDate))
WHERE (ScheduleID = @ScheduleID)">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ScheduleID"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"StudentID"
/>
<
asp:Parameter
Name
=
"ServiceID"
/>
<
asp:Parameter
Name
=
"RotationID"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"StudentID"
/>
<
asp:Parameter
Name
=
"ServiceID"
/>
<
asp:Parameter
Name
=
"StartDate"
/>
<
asp:Parameter
Name
=
"ScheduleID"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"ServiceDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
SelectCommand="SELECT [ServiceID], [ServiceName] FROM [Service] ORDER BY [ServiceName]">
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"StudentDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
SelectCommand="SELECT [StudentID], [FullName] FROM [Student] ORDER BY [FullName]">
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"RotationDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
SelectCommand="SELECT [RotationID], [RotationStart] FROM [Rotation] ORDER BY [RotationStart]">
</
asp:SqlDataSource
>
</
form
>
Protected Sub btnShowChart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShowChart.Click
chTotal.DataSource = GetChartData()
chTotal.DataBind()
End Sub
Private Function GetChartData() As DataTable
Dim pCustomerID As New SqlClient.SqlParameter("@CustomerID", 8)
Dim pFromPeriodID As New SqlClient.SqlParameter("@FromPeriodID", 8)
Dim pToPeriodID As New SqlClient.SqlParameter("@ToPeriodID", 8)
Dim pHasPPCTotals As New SqlClient.SqlParameter("@HasPPCTotals", SqlDbType.TinyInt)
pCustomerID.Value = Session("CustomerID")
If cbPPCTotal.Checked = True Then
pHasPPCTotals.Value = 1
Else
pHasPPCTotals.Value = 0
End If
pFromPeriodID.Value = cbDateFromChart.SelectedValue
pToPeriodID.Value = cbDateUntilChart.SelectedValue
Dim tblResults As DataTable = ExecuteDataTable(ConnectionStrings.BilConnString, "GetCustomerSpendVessel", New Object() {pCustomerID, pFromPeriodID, pToPeriodID, pHasPPCTotals})
chTotal.Series(0).DataYColumn = "Total"
chTotal.PlotArea.XAxis.DataLabelsColumn = "Vessel"
chTotal.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 0
chTotal.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.DarkBlue
chTotal.PlotArea.Appearance.Dimensions.Margins.Bottom = Telerik.Charting.Styles.Unit.Percentage(12)
GetChartData = tblResults
End Function
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridDataItem gridDataItem = e.Item
as
GridDataItem;
DataRowView dvRow = gridDataItem.DataItem
as
DataRowView;
RadComboBox cmbPositionID = gridDataItem.FindControl(
"comboPositionID"
)
as
RadComboBox;
cmbPositionID.SelectedValue = dvRow[
"PositionID"
].ToString();
RadListBox listBox = gridDataItem.FindControl(
"comboLanguageID"
)
as
RadListBox;
string
value = dvRow[
"LanguageID"
].ToString();
string
[] values = value.Split(
new
char
[] {
','
}, StringSplitOptions.RemoveEmptyEntries);
foreach
(
string
val
in
values)
{
RadListBoxItem item = listBox.FindItemByText(val);
if
(item !=
null
)
item.Selected =
true
;
}
}