Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd parameter in SqlDataSource from code-behind
    text
    copied!<p>I have a grid on my page that I want to fill with data that is provided by a stored procedure that it has some parameter that is read from a cookie. I don't know how can I add parameter to <code>SqlDataSource</code> dynamically and assign it to grid?</p> <pre><code> &lt;/telerik:RadScriptManager&gt; &lt;telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="715px"&gt; &lt;telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" CellSpacing="0" GridLines="None" Height="533px" PageSize="7" AllowFilteringByColumn="True" FilterItemStyle-Width="400px" DataSourceID="dsNew"&gt; &lt;ClientSettings&gt; &lt;Selecting CellSelectionMode="None" /&gt; &lt;Scrolling AllowScroll="True" UseStaticHeaders="True" /&gt; &lt;/ClientSettings&gt; &lt;AlternatingItemStyle BackColor="#CCCCCC" /&gt; &lt;MasterTableView datasourceid="dsNew"&gt; &lt;CommandItemSettings ExportToPdfText="Export to PDF" /&gt; &lt;RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True"&gt; &lt;/RowIndicatorColumn&gt; &lt;ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True"&gt; &lt;/ExpandCollapseColumn&gt; &lt;EditFormSettings&gt; &lt;EditColumn FilterControlAltText="Filter EditCommandColumn column"&gt; &lt;/EditColumn&gt; &lt;/EditFormSettings&gt; &lt;/MasterTableView&gt; &lt;FilterItemStyle Width="400px" /&gt; &lt;FilterMenu EnableImageSprites="False"&gt; &lt;/FilterMenu&gt; &lt;/telerik:RadGrid&gt; &lt;asp:SqlDataSource ID="dsNew" runat="server" ConnectionString="&lt;%$ ConnectionStrings:DB_BankSafeDepositBoxesConnectionString %&gt;" SelectCommand="S_Boxes_StatusReport" SelectCommandType="StoredProcedure"&gt; &lt;SelectParameters&gt; &lt;asp:CookieParameter Name="BranchID" CookieName="userauth" /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre>
 

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