0

我的页面上有一个网格,我想用存储过程提供的数据填充它,它有一些从 cookie 读取的参数。我不知道如何SqlDataSource动态添加参数并将其分配给网格?

 </telerik:RadScriptManager>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" 
    Width="715px">
    <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">
        <ClientSettings>
            <Selecting CellSelectionMode="None" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
        <AlternatingItemStyle BackColor="#CCCCCC" />
        <MasterTableView datasourceid="dsNew">
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" 
                Visible="True">
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" 
                Visible="True">
            </ExpandCollapseColumn>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterItemStyle Width="400px" />
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="dsNew" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_BankSafeDepositBoxesConnectionString %>" 
        SelectCommand="S_Boxes_StatusReport" SelectCommandType="StoredProcedure">
       <SelectParameters>
             <asp:CookieParameter Name="BranchID" CookieName="userauth" />
            </SelectParameters>
    </asp:SqlDataSource>
4

1 回答 1

0

您可以按如下方式使用:-

    <SelectParameters>
        <asp:CookieParameter Name="email" CookieName="email_id" />
    </SelectParameters>

MSDN 链接
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.cookieparameter.aspx

于 2013-02-19T12:37:46.193 回答