I have two pages named WorkingExpand.aspx and NotWorkingExpand.aspx. Both pages have this declaration:
For WorkingExpand.aspx codebehind, I have this declaration on the Load method:
So notice that the binding to the grid was called on the page load method. There was no need to use advanced databinding to make the expand/collapse work. It just works.
However for the NotWorkingExpand.aspx code behind, here is how the data is bind:
When the collapse/expand button is selected, it throws an error
Any help?
<
telerik:RadGrid
ID
=
"rgRequirements"
runat
=
"server"
Width
=
"100px"
CellSpacing
=
"0"
GridLines
=
"None"
EnableEmbeddedSkins
=
"True"
Skin
=
"Black"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
>
<
NoRecordsTemplate
>
<
asp:Label
ID
=
"nocourses"
runat
=
"server"
Font-Size
=
"16px"
Text
=
"No courses are currently selected for this organization."
></
asp:Label
>
</
NoRecordsTemplate
>
<
Columns
>
<
telerik:GridTemplateColumn
HeaderStyle-HorizontalAlign
=
"Center"
>
<!-- Some Column Definition -->
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
For WorkingExpand.aspx codebehind, I have this declaration on the Load method:
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
If
Not
Page.IsPostBack
Then
' Some code omitted.
fill_requirements()
end if
End
Sub
Sub
fill_requirements()
Dim
dt
As
DataTable =
New
DataTable
dt = ThisMethodReallyReturnsData()
Me
.rgRequirements.DataSource = dt
'Grouping declared here
Me
.rgRequirements.GroupingEnabled =
True
Dim
groupExpression
As
GridGroupByExpression = GridGroupByExpression.Parse(
"Module Group By Module"
)
Me
.rgRequirements.MasterTableView.GroupByExpressions.Add(groupExpression)
Me
.rgRequirements.DataBind()
End
Sub
So notice that the binding to the grid was called on the page load method. There was no need to use advanced databinding to make the expand/collapse work. It just works.
However for the NotWorkingExpand.aspx code behind, here is how the data is bind:
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
'No related code
End
Sub
Protected
Sub
rgRequirements_NeedDataSource(
ByVal
source
As
System.
Object
,
ByVal
e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
LoadGrid()
End
Sub
Protected
Sub
LoadGrid()
' dtRequirements is a global variable
dtRequirements = MethodThatHasDataAsWell()
Me
.rgRequirements.DataSource = dtRequirements
Me
.rgRequirements.GroupingEnabled =
True
Dim
groupExpression
As
GridGroupByExpression = GridGroupByExpression.Parse(
"Module Group By Module"
)
Me
.rgRequirements.MasterTableView.GroupByExpressions.Add(groupExpression)
End
Sub
When the collapse/expand button is selected, it throws an error
Unhandled exception at line 6, column 74203
in
http:
//localhost:30710/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_ContentContent_rsmTrainingRequirements_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:c9cbdec3-c810-4e87-846c-fb25a7c08002:ea597d4b:b25378d2;Telerik.Web.UI,+Version=2013.2.611.40,+Culture=neutral,+PublicKeyToken=121fae78165ba3d4:en-US:8a277cf4-155d-4ba9-b3c0-d6f62646e5f2:16e4e7cd:ed16cbdc:f7645509:58366029
0x800a138f - Microsoft JScript runtime error:
'undefined'
is
null
or not an object
Any help?