473,325 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

dropdownlist as templatefield needs outer gridview's row value as select parameter

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:DropDownList ID="ddlStatus" runat="server"
DataSourceID="SqlDataSource2" DataTextField="NAME" DataValueField="ID"
SelectedValue='<%# Bind("CURRENT_STATUS") %>'>
</asp:DropDownList>
<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:Parameter Name="CURRENT_STATUS" Type="Decimal" />
<asp:Parameter Name="INSPECTION_ID" Type="Decimal" />
<asp:Parameter Name="ID" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>

Jun 14 '06 #1
0 1575

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: P. Yanzick | last post by:
Hello, I've been playing with master/detail views as well as editing in the gridview, and I ran across a strange problem that I am not exactly sure where to go to try to solve. I have 2...
6
by: Dabbler | last post by:
I have a dropdownlist in a GridView ItemTemplate. I need to bind the ddl to an SqlDataSource, then have a value from a boundfield in the row be passed as the keyfield for select where clause. Im...
0
by: dawg1998 | last post by:
I am able to populate a DropDownList control within multiple rows of a GridView with the following code: `````````````````````````````````````````````````````` <asp:GridView id="gvGridView"...
1
by: mitchman10 | last post by:
My Time table has TimeID,Employee,PayPeriod,ChargeCodeID,Hours My Chargecode table has ChargecodeID,c_Text I need an Editable datagrid that will show the TimeID,Employee,PayPeriod,C_Text in a...
3
by: Jon Paal | last post by:
this text keeps showing up in my gridview dropdownlist "System.Data.DataRowView" How do I prevent this problem ?
2
by: teddymeu | last post by:
Hi Guys, this is kinda complicated but ill do my best to explain. I have two tables. products and categories. Products holds product info and an image, its primary key is ProductID. Category table...
0
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ...
0
by: Moneypenny | last post by:
Hi there, I have a Gridview control which has a dropdownlist in every row. The dropdowns are populated dynamically from a database (so the content is different in each row. There is also a select...
0
by: Dan | last post by:
Hi, I have a detailsview with two fields: in editmode, one is a textbox and the other is a dropdownlist. i want to update both fields using the detailsview. My problem: when clicking on the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.