J
JJ
Hi.
I am having trouble getting a dropdownlist to work properly in a
detailsview:
The code is something like:
<aspetailsView ID="dvwSubscriber" runat="server" AutoGenerateRows="False"
DataKeyNames="ID" DataSourceID="objCurrentSubscriber" DefaultMode="Insert"
HeaderText="Subscriber Details">
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<ItemTemplate>
<asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title")
%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList runat="server" ID="ddlTitles"
DataSourceID="objTitles" SkinID="CenCol_dd_Lg_WithVal"
CssClass="input_box_text" DataTextField="text"
DataValueField="value" SelectedValue='<%# Bind("Title") %>'
Width="100%" ValidationGroup="EditProfile" AppendDataBoundItems="True"
OnDataBound="ddlTitles_OnDataBound">
</aspropDownList>
<asp:ObjectDataSource ID="objTitles" runat="server"
SelectMethod="GetTitlesDataview" TypeName="MyNamespace.Helpers"
OnObjectCreated ="objTitles_ObjectCreated" >
</asp:ObjectDataSource>
This code results in an error when I try to load a row into the detailsview:
'ddlTitles' has a SelectedValue which is invalid because it does not exist
in the list of items.
Parameter name: value'
Yet the current Row in objCurrentSubscriber does appear to match one of the
values in objTitles.
objCurrentSubscriber is retrieved from an SQL table has a column named
'Title'
objTitlesis a dataview that I programmatically construct from array string .
The Columns are 'text' and 'value' and, in effect are both the same (i.e.
(Mr, Mr), (Mrs, Mrs), etc)
I basically want the dropdown to show the correct entry for the detailsview
current row when in Edit mode - i.e. objCurrentSubscriber 's current row has
a 'Title' set to 'Mrs', so the dropdownlist should display 'Mrs'. When in
insert mode, the dropdownlist will show the options from objTitles.
Sounds simple but can I achieve it!?!
Please help!
JJ
I am having trouble getting a dropdownlist to work properly in a
detailsview:
The code is something like:
<aspetailsView ID="dvwSubscriber" runat="server" AutoGenerateRows="False"
DataKeyNames="ID" DataSourceID="objCurrentSubscriber" DefaultMode="Insert"
HeaderText="Subscriber Details">
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<ItemTemplate>
<asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title")
%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList runat="server" ID="ddlTitles"
DataSourceID="objTitles" SkinID="CenCol_dd_Lg_WithVal"
CssClass="input_box_text" DataTextField="text"
DataValueField="value" SelectedValue='<%# Bind("Title") %>'
Width="100%" ValidationGroup="EditProfile" AppendDataBoundItems="True"
OnDataBound="ddlTitles_OnDataBound">
</aspropDownList>
<asp:ObjectDataSource ID="objTitles" runat="server"
SelectMethod="GetTitlesDataview" TypeName="MyNamespace.Helpers"
OnObjectCreated ="objTitles_ObjectCreated" >
</asp:ObjectDataSource>
This code results in an error when I try to load a row into the detailsview:
'ddlTitles' has a SelectedValue which is invalid because it does not exist
in the list of items.
Parameter name: value'
Yet the current Row in objCurrentSubscriber does appear to match one of the
values in objTitles.
objCurrentSubscriber is retrieved from an SQL table has a column named
'Title'
objTitlesis a dataview that I programmatically construct from array string .
The Columns are 'text' and 'value' and, in effect are both the same (i.e.
(Mr, Mr), (Mrs, Mrs), etc)
I basically want the dropdown to show the correct entry for the detailsview
current row when in Edit mode - i.e. objCurrentSubscriber 's current row has
a 'Title' set to 'Mrs', so the dropdownlist should display 'Mrs'. When in
insert mode, the dropdownlist will show the options from objTitles.
Sounds simple but can I achieve it!?!
Please help!
JJ