M
Managed Code
Hello,
I have a status and definition table. The status table's current
status field relates the ID field of the definition table. I am trying
to retrieve the definitions that are associated only with the master_id
for the status table's current status. After having some trouble
databinding I found a solution using a hidden label to save the value I
need for my select parameter. The error I am receiving is
'ddlStatus' has a SelectedValue which is invalid because it does not
exist in the list of items.
Parameter name: value
Any hints on where to go from here would be appreciated.
Thanks, MC
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="OracleDataSource1">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True"
SortExpression="ID" Visible="False" />
<asp:BoundField DataField="INSPECTION_ID" HeaderText="INSPECTION_ID"
SortExpression="INSPECTION_ID" />
<asp:TemplateField HeaderText="CURRENT_STATUS"
SortExpression="CURRENT_STATUS">
<ItemTemplate>
<%# GetStatusDisplayText( Eval("CURRENT_STATUS")) %>
</ItemTemplate>
<EditItemTemplate>
<asp
ropDownList ID="ddlStatus" runat="server"
DataSourceID="SqlDataSource2" DataTextField="NAME" DataValueField="ID"
SelectedValue='<%# Bind("CURRENT_STATUS") %>'>
</asp
ropDownList>
<asp:Label ID="lblHidden" Visible="false" runat="server" Text =
'<%# Eval("INSPECTION_ID") %>' />
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ATLQACS %>" ProviderName="<%$
ConnectionStrings:ATLQACS.ProviderName %>" SelectCommand="select ID,
NAME from WF_DEFINITION WHERE MASTER_ID = ( select MASTER_ID from
WF_STATUS , WF_DEFINITION where WF_STATUS.CURRENT_STATUS =
WF_DEFINITION.ID and WF_STATUS.INSPECTION_ID = :INSPECTION_ID)">
<SelectParameters>
<asp:ControlParameter ControlID="lblHidden" Name="INSPECTION_ID"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="OracleDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ATLQACS %>" ProviderName="<%$
ConnectionStrings:ATLQACS.ProviderName %>" SelectCommand='SELECT "ID",
"CURRENT_STATUS", "INSPECTION_ID" FROM "WF_STATUS" ORDER BY
"INSPECTION_ID"' UpdateCommand='UPDATE "WF_STATUS" SET "CURRENT_STATUS"
= :CURRENT_STATUS, "INSPECTION_ID" = :INSPECTION_ID WHERE "ID" = :ID'>
<UpdateParameters>
<asp
arameter Name="CURRENT_STATUS" Type="Decimal" />
<asp
arameter Name="INSPECTION_ID" Type="Decimal" />
<asp
arameter Name="ID" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
I have a status and definition table. The status table's current
status field relates the ID field of the definition table. I am trying
to retrieve the definitions that are associated only with the master_id
for the status table's current status. After having some trouble
databinding I found a solution using a hidden label to save the value I
need for my select parameter. The error I am receiving is
'ddlStatus' has a SelectedValue which is invalid because it does not
exist in the list of items.
Parameter name: value
Any hints on where to go from here would be appreciated.
Thanks, MC
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="OracleDataSource1">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True"
SortExpression="ID" Visible="False" />
<asp:BoundField DataField="INSPECTION_ID" HeaderText="INSPECTION_ID"
SortExpression="INSPECTION_ID" />
<asp:TemplateField HeaderText="CURRENT_STATUS"
SortExpression="CURRENT_STATUS">
<ItemTemplate>
<%# GetStatusDisplayText( Eval("CURRENT_STATUS")) %>
</ItemTemplate>
<EditItemTemplate>
<asp
DataSourceID="SqlDataSource2" DataTextField="NAME" DataValueField="ID"
SelectedValue='<%# Bind("CURRENT_STATUS") %>'>
</asp
<asp:Label ID="lblHidden" Visible="false" runat="server" Text =
'<%# Eval("INSPECTION_ID") %>' />
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ATLQACS %>" ProviderName="<%$
ConnectionStrings:ATLQACS.ProviderName %>" SelectCommand="select ID,
NAME from WF_DEFINITION WHERE MASTER_ID = ( select MASTER_ID from
WF_STATUS , WF_DEFINITION where WF_STATUS.CURRENT_STATUS =
WF_DEFINITION.ID and WF_STATUS.INSPECTION_ID = :INSPECTION_ID)">
<SelectParameters>
<asp:ControlParameter ControlID="lblHidden" Name="INSPECTION_ID"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="OracleDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ATLQACS %>" ProviderName="<%$
ConnectionStrings:ATLQACS.ProviderName %>" SelectCommand='SELECT "ID",
"CURRENT_STATUS", "INSPECTION_ID" FROM "WF_STATUS" ORDER BY
"INSPECTION_ID"' UpdateCommand='UPDATE "WF_STATUS" SET "CURRENT_STATUS"
= :CURRENT_STATUS, "INSPECTION_ID" = :INSPECTION_ID WHERE "ID" = :ID'>
<UpdateParameters>
<asp
<asp
<asp
</UpdateParameters>
</asp:SqlDataSource>