I am trying to insert a user control into an item template of a radgrid to display data dynamically, but I keep getting an object reference not set to an instance of an object error when it tries to set the property container.
Below is a snippet of where I am using the user control in the radgrid:
Below is a snippet of the code behind:
The employee's properties are not null, and the fields will not be editable.
Any assistance would be appreciated. Thanks.
Joe
Below is a snippet of where I am using the user control in the radgrid:
<%@ Register Src="PropertyContainer.ascx" TagName="PropertyContainer" TagPrefix="uc1" %>
<
radG:RadGrid
ID
=
"employees"
OnNeedDataSource
=
"EmployeesGrid_NeedDataSource"
runat
=
"server"
AutoGenerateColumns
=
"false"
>
<
Columns
>
<
radG:GridTemplateColumn
>
<
ItemTemplate
>
<
uc1:PropertyContainer
ID
=
"PropertyContainer"
runat
=
"server"
/>
</
ItemTemplate
>
</
radG:GridTemplateColumn
>
</
Columns
>
Below is a snippet of the code behind:
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
public
void
EmployeesGrid_NeedDataSource(
object
source, Telerik.WebControls.GridNeedDataSourceEventArgs e)
{
foreach
(Employee emp
in
Employees)
{
PropertyContainer.SetProperties(emp.Properties);
}
)
The employee's properties are not null, and the fields will not be editable.
Any assistance would be appreciated. Thanks.
Joe