Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding ControlParameter to SqlDataSource prevents query and databinding?
    primarykey
    data
    text
    <p>I have a SqlDataSource that calls a stored procedure and it works fine. If I add a <code>&lt;ControlParameter&gt;</code> tag to add an additional argument, then the query never fires and the databinding never occurs. Suggestions?</p> <p><strong>This works</strong>:</p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:DefaultDB %&gt;" SelectCommand="SP_WHATEVER" SelectCommandType="StoredProcedure" UpdateCommand="SP_WHATEVER2" UpdateCommandType="StoredProcedure"&gt; &lt;SelectParameters&gt; &lt;asp:SessionParameter DefaultValue="" Name="UserName" SessionField="RP_Program" Type="String" /&gt; &lt;/SelectParameters&gt; &lt;UpdateParameters&gt; &lt;snip...&gt; &lt;/UpdateParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre> <p><strong>When I add the ControlParameter, the databinding no longer occurs</strong>:</p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:DefaultDB %&gt;" SelectCommand="SP_WHATEVER" SelectCommandType="StoredProcedure" UpdateCommand="SP_WHATEVER2" UpdateCommandType="StoredProcedure"&gt; &lt;SelectParameters&gt; &lt;asp:SessionParameter DefaultValue="" Name="UserName" SessionField="RP_Program" Type="String" /&gt; &lt;asp:ControlParameter Name="SprocArgName" ControlID="ddlFilter" PropertyName="SelectedValue" Type="String" /&gt; &lt;/SelectParameters&gt; &lt;UpdateParameters&gt; &lt;snip...&gt; &lt;/UpdateParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre> <p>The ControlParameter refers to a valid object on the page. Any other suggestions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload