RadGrid - Code behind Data Source - EditFormSettings Template - Binding a field
Hello,
So I am trying to use the edit popup for the RadGrid and creating a custom template. The problem I am running into is the field I want to display is not working and throwing this error:
Sys.WebForms.PageRequestManagerServerErrorException: Value cannot be null.
Parameter name: expression
I tried to bind the data a couple of different ways and am not getting it. Here is my RadGrid, please let me know what I am doing wrong. The grid shows the data correctly, it is just when I click on the "View" link it breaks. Keep in mind, without the Label field in the template, the popup does work and shows the Patient Number in the header.
<
telerik:RadGrid
id
=
"rgEmployees"
runat
=
"server"
allowpaging
=
"True"
AllowSorting
=
"true"
PageSize
=
"10"
AutoGenerateColumns
=
"False"
AllowFilteringByColumn
=
"false"
Skin
=
"Outlook"
>
<
MasterTableView
EditMode
=
"PopUP"
PageSize
=
"10"
DataKeyNames
=
"Emp#"
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"Emp#"
DataField
=
"Emp#"
Visible
=
"false"
></
telerik:GridBoundColumn
>
<
telerik:GridEditCommandColumn
UniqueName
=
"ViewColumn"
EditText
=
"View"
></
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"LastName"
HeaderText
=
"Last Name"
SortExpression
=
"LastName"
DataField
=
"LastName"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"FirstName"
HeaderText
=
"First Name"
SortExpression
=
"FirstName"
DataField
=
"FirstName"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"DeptName"
HeaderText
=
"Department Name"
SortExpression
=
"DeptName"
DataField
=
"DeptName"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"HireDate"
HeaderText
=
"Last Hire Date"
SortExpression
=
"HireDate"
DataField
=
"HireDate"
></
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
CaptionFormatString
=
"View Patient Number: 0"
CaptionDataField
=
"Emp#"
EditFormType
=
"Template"
PopUpSettings-Modal
=
"true"
>
<
FormTemplate
>
<
table
id
=
"tbView"
cellspacing
=
"1"
cellpadding
=
"1"
width
=
"250"
border
=
"0"
>
<
tr
>
<
td
>
</
td
>
<
td
>
</
td
>
</
tr
>
<
tr
>
<
td
>First Name:</
td
>
<
td
>
<
asp:Label
ID
=
"lblFName"
Text='<%# DataBinder.Eval(Container.DataItem, "FirstName") %>' runat="server" />
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect="true />
</
ClientSettings
>
</
telerik:RadGrid
>
Hello Kameron,
The javascript error is a result of the server error exception. I suggest that you review this help article for more information on error handling with RadAjax. Please check if you do not have duplicate IDs in the dynamically loaded controls. If any issues persist, can you please send us the complete sample of your custom control so we can examine it further.
All the best,
Boyan Barnev
the Telerik team