I have tried all the demos and examples and nothing has worked!
Markup:
Now, heres where it works and doesn't. If I have this line (similar for the second drop down):
when I go into edit mode, the drop downs are populated with the current values which is a project requirement. But when I click the 'Add new user', I get this error:
'cmbEdit_Rights' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
If I leave out the <%# Bind("UserLevel") %> I can insert and update, but I loose the requirement of displaying the current value which I need.
Please help asap!
Markup:
<telerik:RadGrid ID="grvUsers" |
runat="server" |
AutoGenerateColumns="False" |
GridLines="None" |
Skin="Office2007" |
OnNeedDataSource="grvUsers_NeedDataSource" |
OnUpdateCommand="grvUsers_UpdateCommand" |
AllowPaging="True" |
AllowSorting="True" |
ShowGroupPanel="True" OnItemCommand="grvUsers_ItemCommand" OnEditCommand="grvUsers_EditCommand"> |
<MasterTableView AllowAutomaticInserts="True" CommandItemDisplay="Top"> |
<RowIndicatorColumn Visible="False"> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
<ExpandCollapseColumn Resizable="False" Visible="False"> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
<Columns> |
<telerik:GridEditCommandColumn> |
</telerik:GridEditCommandColumn> |
<telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="LastName"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="FirstName"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="UserLevel" HeaderText="User Rights" UniqueName="Rights"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="Enabled" HeaderText="Enabled" UniqueName="Enabled"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="UserInfoUID" UniqueName="UserInfoUID" Visible="False"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="UserName" UniqueName="UserName" Visible="False"> |
</telerik:GridBoundColumn> |
</Columns> |
<EditFormSettings EditFormType="Template" CaptionFormatString="Edit the information for <%# Bind('FirstName') %> <%# Bind('LastName') %>" > |
<EditColumn UniqueName="EditCommandColumn1"></EditColumn> |
<FormTemplate> |
<table style="width: 568px"> |
<tr> |
<td style="width: 131px"> |
Last Name</td> |
<td style="width: 160px"> |
<telerik:RadTextBox ID="txtEdit_LastName" runat="server" MaxLength="50" Text="<%# Bind('LastName') %>"> |
</telerik:RadTextBox></td> |
<td> |
<asp:RequiredFieldValidator ID="rfvEdit_LastName" runat="server" ControlToValidate="txtEdit_LastName" |
ErrorMessage="Please enter the users last name" ValidationGroup="Edit">*</asp:RequiredFieldValidator> |
</td> |
<td style="width: 174px"> |
First Name</td> |
<td style="width: 156px"> |
<telerik:RadTextBox ID="txtEdit_FirstName" runat="server" MaxLength="50" Text="<%# Bind('FirstName') %>"> |
</telerik:RadTextBox></td> |
<td> |
<asp:RequiredFieldValidator ID="rfvEdit_FirstName" runat="server" ControlToValidate="txtEdit_FirstName" |
ErrorMessage="Please enter the users first name" ValidationGroup="Edit">*</asp:RequiredFieldValidator></td> |
</tr> |
<tr> |
<td style="width: 131px"> |
Username</td> |
<td style="width: 160px"> |
<telerik:RadTextBox ID="txtEdit_Username" runat="server" Text="<%# Bind('Username') %>"> |
</telerik:RadTextBox></td> |
<td> |
<asp:RequiredFieldValidator ID="rfvEdit_UserName" runat="server" ControlToValidate="txtEdit_Username" |
ErrorMessage="Please enter the users 'Username'" ValidationGroup="Edit">*</asp:RequiredFieldValidator></td> |
<td style="width: 174px"> |
</td> |
<td style="width: 156px"> |
</td> |
<td> |
</td> |
</tr> |
<tr> |
<td style="width: 131px; height: 27px"> |
Password</td> |
<td style="width: 160px; height: 27px"> |
<telerik:RadTextBox ID="txtEdit_Password" runat="server" InvalidStyleDuration="100" Text="<%# Bind('Password') %>" Width="125px" EmptyMessage="************" MaxLength="20" TextMode="Password"> |
</telerik:RadTextBox></td> |
<td style="height: 27px"> |
</td> |
<td style="width: 174px; height: 27px"> |
Password</td> |
<td style="height: 27px; width: 156px;"> |
<telerik:RadTextBox ID="txtEdit_ConfirmPassword" runat="server" InvalidStyleDuration="100" Text="<%# Bind('Password') %>" TextMode="Password" Width="125px" EmptyMessage="***********" MaxLength="20"> |
</telerik:RadTextBox> |
</td> |
<td style="height: 27px"> |
</td> |
</tr> |
<tr> |
<td> |
Rights</td> |
<td> |
<asp:DropDownList ID="cmbEdit_Rights" runat="server" Width="119px" SelectedValue='<%# Bind("UserLevel") %>'> |
<asp:ListItem>User</asp:ListItem> |
<asp:ListItem>Admin</asp:ListItem> |
</asp:DropDownList></td> |
<td> |
</td> |
<td> |
Enabled</td> |
<td> |
<asp:DropDownList ID="cmbEdit_Enabled" runat="server" Width="119px" SelectedValue='<%# Bind("Enabled") %>'> |
<asp:ListItem Value="True">Yes</asp:ListItem> |
<asp:ListItem Value="False">No</asp:ListItem> |
</asp:DropDownList></td> |
<td> |
</td> |
</tr> |
<tr> |
<td colspan="6"> |
</td> |
</tr> |
<tr> |
<td align="right" colspan="6"> |
<asp:LinkButton ID="lnkEdit_Cancel" runat="server" CausesValidation="False" CommandName="Cancel" Text='<%# (Container is GridEditFormInsertItem) ? "Done" : "Cancel" %>' >Cancel</asp:LinkButton> |
<asp:LinkButton ID="lnkEdit_Done" runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' Text='<%# (Container is GridEditFormInsertItem) ? "Save" : "Save Changes" %>'></asp:LinkButton> |
|
</td> |
</tr> |
<tr> |
<td align="center" colspan="6"> |
<asp:Label ID="lblUID" runat="server" Text="<%# Bind('UserInfoUID') %>" Visible="False"></asp:Label> |
<asp:Label ID="lblEdit_Message" runat="server"></asp:Label> |
</td> |
</tr> |
<tr> |
<td align="center" colspan="6" style="height: 21px"> |
<asp:ValidationSummary ID="vsEdit" runat="server" ValidationGroup="Edit" /> |
</td> |
</tr> |
</table> |
</FormTemplate> |
<PopUpSettings ScrollBars="None" /> |
</EditFormSettings> |
<CommandItemSettings AddNewRecordText="Add new user" /> |
<PagerStyle AlwaysVisible="True" HorizontalAlign="Left" Mode="Slider" /> |
</MasterTableView> |
<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowDragToGroup="True"> |
<Selecting AllowRowSelect="True" /> |
</ClientSettings> |
</telerik:RadGrid> |
Now, heres where it works and doesn't. If I have this line (similar for the second drop down):
<asp:DropDownList ID="cmbEdit_Enabled" runat="server" Width="119px" SelectedValue='<%# Bind("Enabled") %>'> |
<asp:ListItem Value="True">Yes</asp:ListItem> |
<asp:ListItem Value="False">No</asp:ListItem> |
</asp:DropDownList> |
'cmbEdit_Rights' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
If I leave out the <%# Bind("UserLevel") %> I can insert and update, but I loose the requirement of displaying the current value which I need.
Please help asap!