G
Guest
In my Registrant FormView I have a DropDownList which loads data from a
secondary SqlDataSource "sdsOfficeParks". I need the user to select an office
park but save the selected value in the FormView's ObjectDataSource
"odsRegistrant" .
The following solution can't work because I need the ddl selected value
bound to my odsRegistrant but both tables have the same column name for
primary key.
<asp
ropDownList ID="ddlOfficePark" runat="server" CssClass="waDdl"
Width="202px"
DataSourceID="sdsOfficePark" DataTextField="OfficeParkName"
DataValueField="OfficeParkId"
SelectedValue='<%# Bind("OfficeParkId")%>' >
<asp:SqlDataSource ID="sdsOfficePark" runat="server"
ProviderName="System.Data.SqlClient"
ConnectionString="<%$ ConnectionStrings:myDB %>"
SelectCommand="Select OfficeParkName, OfficeParkId from db
fficePark
order by OfficeParkName ">
</asp:SqlDataSource>
<asp:ObjectDataSource ID="odsRegistrant" runat="server"
TypeName="RegistrantDB"
DeleteMethod="DeleteRegistrant" InsertMethod="InsertRegistrant"
SelectMethod="GetRegistrant"
UpdateMethod="UpdateRegistrant" DataObjectTypeName="RegistrantDetails" >
<UpdateParameters>
<asp
arameter Name="officeParkId" Type="Int32"/>
....
Note that for most rows in the database the OfficeParkId is 0 and there is
no zero entry in the ddl. Could this be the problem and how do I load a
(choose one) entry before the data is loaded?
Thanks for any ideas.
secondary SqlDataSource "sdsOfficeParks". I need the user to select an office
park but save the selected value in the FormView's ObjectDataSource
"odsRegistrant" .
The following solution can't work because I need the ddl selected value
bound to my odsRegistrant but both tables have the same column name for
primary key.
<asp
Width="202px"
DataSourceID="sdsOfficePark" DataTextField="OfficeParkName"
DataValueField="OfficeParkId"
SelectedValue='<%# Bind("OfficeParkId")%>' >
<asp:SqlDataSource ID="sdsOfficePark" runat="server"
ProviderName="System.Data.SqlClient"
ConnectionString="<%$ ConnectionStrings:myDB %>"
SelectCommand="Select OfficeParkName, OfficeParkId from db
order by OfficeParkName ">
</asp:SqlDataSource>
<asp:ObjectDataSource ID="odsRegistrant" runat="server"
TypeName="RegistrantDB"
DeleteMethod="DeleteRegistrant" InsertMethod="InsertRegistrant"
SelectMethod="GetRegistrant"
UpdateMethod="UpdateRegistrant" DataObjectTypeName="RegistrantDetails" >
<UpdateParameters>
<asp
....
Note that for most rows in the database the OfficeParkId is 0 and there is
no zero entry in the ddl. Could this be the problem and how do I load a
(choose one) entry before the data is loaded?
Thanks for any ideas.