Hi
I am using VS 2010 and telerik controls and some how the grids on the page is not displaying the data.
I am using following code.
ASPX
I am using VS 2010 and telerik controls and some how the grids on the page is not displaying the data.
I am using following code.
ASPX
<
div
style
=
"width: 80%"
>
<
telerik:RadAjaxPanel
runat
=
"server"
ID
=
"RadAjaxPanel1"
>
<
div
style="float: left; height: 100%; width: 55px; background: #E3EFFF; text-align: center;
border-right: 1px solid #6593CF;">
<
img
src
=
"images/tasks.gif"
alt
=
""
/></
div
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowPaging
=
"True"
AllowSorting
=
"True"
GridLines
=
"None"
Width
=
"585px"
>
<
MasterTableView
AllowMultiColumnSorting
=
"true"
/>
<
SortingSettings
SortedBackColor
=
"Azure"
EnableSkinSortStyles
=
"false"
/>
<
HeaderStyle
Width
=
"100px"
/>
</
telerik:RadGrid
>
</
telerik:RadAjaxPanel
>
</
div
>
protected
void
PRate_Load(
object
sender, EventArgs e)
{
LoadData();
}
protected
void
LoadData()
{
var Person = TypeCreator.TypeGenerator(
new
[]{
new
{ID=1, PackageName=
"1 Week"
, Duration=
"1 Week"
, Rate=29, Price=100},
new
{ID=2, PackageName=
"1 Month(s)"
, Duration=
"1 Week"
, Rate=29, Price=100},
new
{ID=3, PackageName=
"3 Month(s)"
, Duration=
"1 Week"
, Rate=29, Price=100},
new
{ID=4, PackageName=
"6 Month(s)"
, Duration=
"1 Week"
, Rate=29, Price=100},
new
{ID=5, PackageName=
"9 Month(s)"
, Duration=
"1 Week"
, Rate=29, Price=100},
new
{ID=6, PackageName=
"12 Month(s)"
, Duration=
"1 Week"
, Rate=29, Price=100}
});
//none of the method is working,
var dt =
new
System.Data.DataTable();
dt.Columns.Add(
new
System.Data.DataColumn(
"ID"
,
typeof
(System.Int16)));
dt.Columns.Add(
new
System.Data.DataColumn(
"PackageName"
,
typeof
(System.String)));
dt.Columns.Add(
new
System.Data.DataColumn(
"Duration"
,
typeof
(System.String)));
System.Data.DataRow dr;
for
(
int
i = 0; i < 100; i++)
{
dr = dt.NewRow();
dr[0] = i;
dr[1] =
"Package"
+ i;
dr[2] = i * 10;
dt.Rows.Add(dr);
}
RadGrid1.DataSource = dt;
RadGrid1.DataBind();
}
static
class
TypeCreator
{
public
static
List<T> TypeGenerator<T>(
this
T[] t)
{
return
new
List<T>(t);
}
}