Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ControlParameter not working?

541716Oct 31 2006 — edited Nov 2 2006
Hello folks,

Running this code, the control parameter 'fred' always seems to be null.
The dropdownlist1 is populated correctly

if i hardcode the where clause in the select statement for the datagrid then it works

<%@ Page Language="C#" %>
<html>
<head runat="server">
<title>Filtering Data In A GridView Using a DropDownList</title>
</head>
<body>
<form id="form1" runat="server">
<b>Choose a manager:</b>
<asp:DropDownList ID="DropDownList1" DataSourceID="SqlDataSource2" AutoPostBack="true"

DataTextField="lname" Runat="server" />
<asp:SqlDataSource ID="SqlDataSource2" Runat="server" SelectCommand="SELECT DISTINCT lname FROM

sj_test"
ProviderName="Oracle.DataAccess.Client"
ConnectionString="User Id=js;Password=12;Data Source=steverdb;" />


<asp:GridView ID="GridView1" AllowSorting="True" AllowPaging="True" Runat="server"
DataSourceID="SqlDataSource1" AutoGenerateEditButton="True" DataKeyNames="pk_int"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField ReadOnly="true" HeaderText="ID" DataField="pk_int" SortExpression="pk_int" />
<asp:BoundField HeaderText="Last Name" DataField="lname" SortExpression="lname" />
<asp:BoundField HeaderText="First Name" DataField="fname" SortExpression="fname" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" Runat="server" ProviderName="Oracle.DataAccess.Client"
ConnectionString="User Id=js;Password=12;Data Source=steverdb;"
SelectCommand="SELECT pk_int, lname, fname FROM sj_test WHERE lname = :fred"
UpdateCommand="UPDATE sj_test SET lname = :lname, fname = :fname WHERE pk_int = :pk_int">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="fred" PropertyName="SelectedValue"

Type="String"/>
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="lname" />
<asp:Parameter Name="fname" />
<asp:Parameter Name="pk_int" />
</UpdateParameters>
</asp:SqlDataSource>
</form>
</body>
</html>


Any clues would be greatly appreciated.

Regards,

Steve
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 30 2006
Added on Oct 31 2006
3 comments
1,803 views