or
Public
Overrides
Sub
ViewLoad(
ByVal
e
As
System.EventArgs)
Try
SetGridFilter(rgEmployee)
Refresh()
UpdateControlState()
Catch
ex
As
Exception
DisplayException(
Me
.ViewName,
Me
.ID, ex)
End
Try
End
Sub
Public
Overrides
Sub
ViewInit(
ByVal
e
As
System.EventArgs)
rgEmployee.AllowCustomPaging =
True
rgEmployee.PageSize = Common.Common.DefaultPageSize
'rgEmployee.ClientSettings.EnablePostBackOnRowClick = True
InitControl()
End
Sub
Protected
Sub
InitControl()
Try
Me
.ctrlMessageBox.Listener =
Me
Me
.MainToolBar = tbarLocations
Common.Common.BuildToolbar(
Me
.MainToolBar, ToolbarItem.Create,
ToolbarItem.Edit,ToolbarItem.Save,
ToolbarItem.Cancel)
CType
(MainToolBar.Items(3), RadToolBarButton).CausesValidation =
True
CType
(
Me
.MainToolBar.Items(3), RadToolBarButton).Enabled =
False
CType
(
Me
.MainToolBar.Items(4), RadToolBarButton).Enabled =
False
Me
.MainToolBar.OnClientButtonClicking =
"OnClientButtonClicking"
'CType(Me.Page, AjaxPage).AjaxManager.ClientEvents.OnRequestStart = "onRequestStart"
Catch
ex
As
Exception
DisplayException(
Me
.ViewName,
Me
.ID, ex)
End
Try
End
Sub
<tlk:RadPane ID=
"RadPane3"
runat=
"server"
Scrolling=
"None"
>
<tlk:RadGrid ID=
"rgEmployee"
runat=
"server"
Height=
"100%"
>
<MasterTableView DataKeyNames=
"ID"
ClientDataKeyNames=
"CODE, EMP_NAME, EMP_AD"
>
<Columns>
<%--<tlk:GridClientSelectColumn> data here --%>
</Columns>
</MasterTableView>
</tlk:RadGrid>
<Common:ctrlMessageBox ID=
"ctrlMessageBox"
runat=
"server"
/>
</tlk:RadPane>
<script type=
"text/javascript"
>
var
enableAjax =
true
;
function
onRequestStart(sender, eventArgs) {
eventArgs.set_enableAjax(enableAjax);
enableAjax =
true
;
}
</script>
.RadWindow span.rwIcon
{
background-position
:
0
!important
;
}
<
telerik:RadListView
ID
=
"lvTest"
runat
=
"server"
attrib
=
"Temp"
ItemPlaceholderID
=
"ItemPlaceHolder1"
AllowPaging
=
"true"
OnNeedDataSource
=
"lvTest_NeedDataSource"
OnItemDataBound
=
"lvTest_ItemDataBound"
GroupAggregatesScope
=
"AllItems"
DataKeyNames
=
"product_id"
>
<
ItemTemplate
>
<
table
style
=
"width:100%;background-color:whitesmoke;border-bottom:1px solid silver;"
>
<
tr
>
<
td
style
=
"width:100px"
>Code:
</
td
>
<
td
>
<%#Eval("Code") %>
<
asp:Button
ID
=
"btnLookup"
runat
=
"server"
Text
=
"View Details"
/>
</
td
>
</
tr
>
<
tr
>
<
td
>Name:
</
td
>
<
td
>
<%#Eval("Name") %>
</
td
>
</
tr
>
<
tr
>
<
td
>Description:
</
td
>
<
td
>
<%#Eval("Desc") %>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
<
LayoutTemplate
>
<
asp:Panel
ID
=
"DataGroupPlaceHolder1"
runat
=
"server"
>
</
asp:Panel
>
</
LayoutTemplate
>
<
DataGroups
>
<
telerik:ListViewDataGroup
GroupField
=
"company_name"
DataGroupPlaceholderID
=
"DataGroupPlaceHolder1"
>
<
DataGroupTemplate
>
<
table
style
=
"border: 1px solid lightgrey; background-color: silver; width:100%;"
>
<
tr
>
<
td
style
=
"background-color: silver; color: white; font-weight: bold;"
>
<%# (Container as RadListViewDataGroupItem).DataGroupKey %>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Panel
runat
=
"server"
ID
=
"ItemPlaceHolder1"
></
asp:Panel
>
</
td
>
</
tr
>
</
table
>
</
DataGroupTemplate
>
<
GroupAggregates
>
<
telerik:ListViewDataGroupAggregate
Aggregate
=
"Min"
DataField
=
"company_id"
/>
</
GroupAggregates
>
</
telerik:ListViewDataGroup
>
</
DataGroups
>
<
GroupSeparatorTemplate
>
<
div
style
=
"background-color: lightgray;height:10px"
>
</
div
>
</
GroupSeparatorTemplate
>
</
telerik:RadListView
>
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
lvTest.DataBind();
}
}
protected
void
lvTest_NeedDataSource(
object
sender, Telerik.Web.UI.RadListViewNeedDataSourceEventArgs e)
{
lvTest.DataSource = GetDataTable();
}
private
object
GetDataTable()
{
DataTable l_Table =
new
DataTable();
l_Table.Columns.Add(
"product_id"
);
l_Table.Columns.Add(
"Code"
);
l_Table.Columns.Add(
"Name"
);
l_Table.Columns.Add(
"Desc"
);
l_Table.Columns.Add(
"company_id"
);
l_Table.Columns.Add(
"company_name"
);
l_Table.Rows.Add(
new
string
[] {
"1"
,
"C001"
,
"Code 001"
,
"Description 001"
,
"1"
,
"Company 1"
});
l_Table.Rows.Add(
new
string
[] {
"2"
,
"C002"
,
"Code 002"
,
"Description 002"
,
"1"
,
"Company 1"
});
l_Table.Rows.Add(
new
string
[] {
"3"
,
"C003"
,
"Code 003"
,
"Description 003"
,
"1"
,
"Company 1"
});
l_Table.Rows.Add(
new
string
[] {
"4"
,
"C004"
,
"Code 004"
,
"Description 004"
,
"2"
,
"Company 2"
});
l_Table.Rows.Add(
new
string
[] {
"5"
,
"C005"
,
"Code 005"
,
"Description 005"
,
"2"
,
"Company 2"
});
l_Table.Rows.Add(
new
string
[] {
"6"
,
"C006"
,
"Code 006"
,
"Description 006"
,
"2"
,
"Company 2"
});
l_Table.Rows.Add(
new
string
[] {
"7"
,
"C007"
,
"Code 007"
,
"Description 007"
,
"2"
,
"Company 2"
});
l_Table.Rows.Add(
new
string
[] {
"8"
,
"C008"
,
"Code 008"
,
"Description 008"
,
"2"
,
"Company 2"
});
l_Table.Rows.Add(
new
string
[] {
"9"
,
"C009"
,
"Code 009"
,
"Description 009"
,
"3"
,
"Company 3"
});
l_Table.Rows.Add(
new
string
[] {
"10"
,
"C010"
,
"Code 010"
,
"Description 010"
,
"3"
,
"Company 3"
});
l_Table.Rows.Add(
new
string
[] {
"11"
,
"C011"
,
"Code 011"
,
"Description 011"
,
"3"
,
"Company 3"
});
l_Table.Rows.Add(
new
string
[] {
"12"
,
"C012"
,
"Code 012"
,
"Description 012"
,
"3"
,
"Company 3"
});
l_Table.Rows.Add(
new
string
[] {
"13"
,
"C013"
,
"Code 013"
,
"Description 013"
,
"4"
,
"Company 4"
});
l_Table.Rows.Add(
new
string
[] {
"14"
,
"C014"
,
"Code 014"
,
"Description 014"
,
"4"
,
"Company 4"
});
l_Table.Rows.Add(
new
string
[] {
"15"
,
"C015"
,
"Code 015"
,
"Description 015"
,
"4"
,
"Company 4"
});
l_Table.Rows.Add(
new
string
[] {
"16"
,
"C016"
,
"Code 016"
,
"Description 016"
,
"4"
,
"Company 4"
});
l_Table.Rows.Add(
new
string
[] {
"17"
,
"C017"
,
"Code 017"
,
"Description 017"
,
"5"
,
"Company 5"
});
l_Table.Rows.Add(
new
string
[] {
"18"
,
"C018"
,
"Code 018"
,
"Description 018"
,
"6"
,
"Company 6"
});
l_Table.Rows.Add(
new
string
[] {
"19"
,
"C019"
,
"Code 019"
,
"Description 019"
,
"6"
,
"Company 6"
});
l_Table.Rows.Add(
new
string
[] {
"20"
,
"C020"
,
"Code 020"
,
"Description 020"
,
"7"
,
"Company 7"
});
l_Table.Rows.Add(
new
string
[] {
"21"
,
"C021"
,
"Code 021"
,
"Description 021"
,
"8"
,
"Company 8"
});
l_Table.Rows.Add(
new
string
[] {
"22"
,
"C022"
,
"Code 022"
,
"Description 022"
,
"8"
,
"Company 8"
});
l_Table.Rows.Add(
new
string
[] {
"23"
,
"C023"
,
"Code 023"
,
"Description 023"
,
"8"
,
"Company 8"
});
l_Table.Rows.Add(
new
string
[] {
"24"
,
"C024"
,
"Code 024"
,
"Description 024"
,
"8"
,
"Company 8"
});
return
l_Table;
}
protected
void
lvTest_ItemDataBound(
object
sender, Telerik.Web.UI.RadListViewItemEventArgs e)
{
try
{
if
(e.Item
is
RadListViewDataItem)
{
if
(e.Item.FindControl(
"btnLookup"
) !=
null
)
{
try
{
string
l_product_ID = (e.Item
as
RadListViewDataItem).GetDataKeyValue(
"product_id"
).ToString();
(e.Item.FindControl(
"btnLookup"
)
as
Button).Text =
"View: "
+ l_product_ID;
}
catch
(Exception)
{
}
}
}
}
catch
(Exception ex)
{
}
}