Solved
Error with the command
Posted on 2013-01-17
Hi,
Why do I get this?
Could not find control 'int_list' in ControlParameter 'desc'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Could not find control 'int_list' in ControlParameter 'desc'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Could not find control 'int_list' in ControlParameter 'desc'.]
System.Web.UI.WebControls.ControlParameter.Evaluate(HttpContext context, Control control) +3226150
System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +152
System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +113
System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +47
System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +444
System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +214
System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +3696829
System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +678
System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e) +148
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +84
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
to this Sqldatasource
...
<asp:SqlDataSource
ID="ds_user_int" Runat="server"
ConnectionString="<%$ ConnectionStrings:Mssqlconn2 %>"
ProviderName="System.Data.SqlClient"
SelectCommand="select int_desc,change_date from tab2 order by 1"
Insertcommand="insert into tab2 (user_id,int_desc,change_date) values (cast(@userid as decimal(10,0)),@desc,@dt)" >
<insertparameters>
<asp:ControlParameter ControlID="lb_userid" Name="userid" PropertyName="Text" />
<asp:ControlParameter ControlID="int_list" Name="desc" PropertyName="Text" />
<asp:ControlParameter ControlID="change_date" Name="dt" PropertyName="Text" />
</insertparameters>
</asp:SqlDataSource>
...
while int_list is
<asp:DropDownList ID="int_list"
width="330px"
DataSourceID="ds_int"
runat="server"
DataTextField="int_desc"
DataValueField="int_desc" >
</asp:DropDownList>