Hello Team,
We are using Rad grid with Form template edit form, we need to place Radio button list with 2 options "Male" and "Female" for gender inside FormTemplate.
Please find Error below:
Code below:
Can anyone help me out with this error?
Thanks in advance.
Regards,
Ruchi Patel
We are using Rad grid with Form template edit form, we need to place Radio button list with 2 options "Male" and "Female" for gender inside FormTemplate.
Please find Error below:
Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: 'rbtGender' has a SelectedValue which is invalid because it does not exist in the list of items.<
br
>Parameter name: value
Code below:
<
telerik:RadGrid
ID
=
"rgDemoRestrictedTests"
runat
=
"server"
CssClass
=
"RadGrid"
GridLines
=
"None"
AllowPaging
=
"True"
PageSize
=
"20"
AllowSorting
=
"True"
AutoGenerateColumns
=
"false"
ShowStatusBar
=
"true"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
DataSourceID
=
"DemoRestrictedTestsSource"
OnItemDeleted
=
"rgDemoRestrictedTests_ItemDeleted"
OnItemInserted
=
"rgDemoRestrictedTests_ItemInserted"
OnItemUpdated
=
"rgDemoRestrictedTests_ItemUpdated"
OnItemCommand
=
"rgDemoRestrictedTests_ItemCommand"
>
<
MasterTableView
CommandItemDisplay
=
"Bottom"
DataSourceID
=
"DemoRestrictedTestsSource"
DataKeyNames
=
"TestID"
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"TestID"
HeaderText
=
"TestID"
DataField
=
"TestID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Gender"
HeaderText
=
"Gender"
DataField
=
"Gender"
>
</
telerik:GridBoundColumn
>
<
telerik:GridEditCommandColumn
HeaderText
=
"Edit"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
CommandName
=
"Delete"
Text
=
"Delete"
HeaderText
=
"Delete"
>
</
telerik:GridButtonColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
table
id
=
"Table2"
cellspacing
=
"2"
cellpadding
=
"1"
width
=
"100%"
border
=
"0"
rules
=
"none"
style
=
"border-collapse: collapse;"
>
<
tr
>
<
td
>
<
table
id
=
"Table3"
width
=
"450px"
border
=
"0"
class
=
"module"
>
<
tr
>
<
td
style
=
"text-align: center;"
>TestID :
</
td
>
<
td
>
<
asp:DropDownList
ID
=
"rddlTestID"
runat
=
"server"
SelectedValue='<%# Bind("TestID") %>'
DataSourceID="rddlTestIDSource" DataTextField="TestID" DataValueField="TestID" AppendDataBoundItems="True">
<
asp:ListItem
Selected
=
"True"
Text
=
"Select"
Value
=
""
>
</
asp:ListItem
>
</
asp:DropDownList
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"text-align: center;"
>Gender :
</
td
>
<
td
>
<
asp:RadioButtonList
runat
=
"server"
ID
=
"rbtGender"
RepeatDirection
=
"Horizontal"
DataValueField
=
"Gender"
SelectedValue='<%# Bind("Gender") %>'>
<
asp:ListItem
Text
=
"Male"
Value
=
"Male"
Selected
=
"True"
></
asp:ListItem
>
<
asp:ListItem
Text
=
"Female"
Value
=
"Female"
></
asp:ListItem
>
</
asp:RadioButtonList
>
</
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
></
td
>
</
tr
>
<
tr
>
<
td
></
td
>
<
td
></
td
>
</
tr
>
<
tr
>
<
td
align
=
"rifht"
colspan
=
"2"
>
<
asp:Button
ID
=
"btnUpdate"
Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></
asp:Button
>
<
asp:Button
ID
=
"btnCancel"
Text
=
"Cancel"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
></
asp:Button
>
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
telerik:RadPageView
>
<
asp:SqlDataSource
runat
=
"server"
ID
=
"DemoRestrictedTestsSource"
ConnectionString
=
"x"
ProviderName
=
"System.Data.SqlClient"
SelectCommand
=
"Select [TestID], (case when [Gender] = 0 then 'Male' else 'Female' end) as [Gender] From [TestUtil_DemoRestrictedTests]"
InsertCommand
=
"Insert Into [TestUtil_DemoRestrictedTests] Values ('@TestID', (case when @Gender = 'Male' then 1 else 0 end))"
UpdateCommand
=
"Update [TestUtil_DemoRestrictedTests] Set [Gender] = (case when @Gender = 'Male' then 0 else 1 end) Where [TestID] = @TestID"
DeleteCommand
=
"DELETE FROM [TestUtil_DemoRestrictedTests] WHERE [TestID] = @TestID"
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"TestID"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Gender"
Type
=
"String"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"Gender"
Type
=
"string"
/>
<
asp:Parameter
Name
=
"TestID"
Type
=
"String"
/>
</
UpdateParameters
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"TestID"
Type
=
"String"
/>
</
DeleteParameters
>
</
asp:SqlDataSource
>
Can anyone help me out with this error?
Thanks in advance.
Regards,
Ruchi Patel