I get the following error when I remove all rows from the grid source and rebind the grid.
Error: 'this.get_element().tBodies.0.rows' is null or not an object
This does not happen in IE7. It happened to me in IE8 and Firefox.
ASPX:
C#:
Error: 'this.get_element().tBodies.0.rows' is null or not an object
This does not happen in IE7. It happened to me in IE8 and Firefox.
ASPX:
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager"
runat
=
"server"
></
telerik:RadScriptManager
>
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel"
runat
=
"server"
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowSorting
=
"True"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
>
<
MasterTableView
AutoGenerateColumns
=
"True"
ClientDataKeyNames
=
"Id"
DataKeyNames
=
"Id"
CommandItemDisplay
=
"Top"
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
></
Selecting
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
></
Scrolling
>
</
ClientSettings
>
</
telerik:RadGrid
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"RadButton"
onclick
=
"RadButton1_Click"
>
</
telerik:RadButton
>
</
telerik:RadAjaxPanel
>
</
form
>
C#:
private
Dictionary<
int
,
string
> GridSource
{
get
{
return
(Dictionary<
int
,
string
>) ViewState[
"gridSource"
];
}
set
{
ViewState[
"gridSource"
] = value;
}
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
GridSource =
new
Dictionary<
int
,
string
>();
for
(
int
i=0; i<2; i++)
{
GridSource.Add(i,
"test data "
+ i);
}
}
}
protected
void
RadButton1_Click(
object
sender, EventArgs e)
{
GridSource.Remove(
int
.Parse(RadGrid1.SelectedItems[0].Cells[2].Text));
RadGrid1.Rebind();
}
protected
void
RadGrid1_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = from d
in
GridSource select
new
{ Id = d.Key, Text = d.Value };
}