嵌套转发器数据源中的参数化表名

时间:2015-10-25 08:33:17

标签: c# asp.net sql-server gridview sqldatasource

我想从gridview上的每一行的不同表中选择一个像cl1这样的列,并在我的转发器上显示它。我怎么能这样做?

这是我的代码:

<asp:gridview cssclass="text-center table table-bordered table-condensed" id="GridView1" runat="server" autogeneratecolumns="False" datakeynames="PID" datasourceid="SqlDataSource2" emptydatatext="There are no data records to display.">
<Columns>                                
    <asp:TemplateField HeaderText="مشخصات اختصاصی">
        <ItemTemplate>
            <asp:Label ID="CatPageLabel" runat="server" Text='<%#Eval("catpage").ToString().Replace(".aspx","") %>'></asp:Label>
            <asp:Repeater ID="SecondPageRepeater" runat="server" DataSourceID="SecondPageSqlDataSource">
                <ItemTemplate>
                    <%#Eval("cl1") %>
                </ItemTemplate>
            </asp:Repeater>
            <asp:SqlDataSource runat="server" ID="SecondPageSqlDataSource" ConnectionString='<%$ ConnectionStrings:DrB_DBConnectionString %>' SelectCommand='select cl1 from @dest where cl1=3'>
                <SelectParameters>                        
                    <asp:ControlParameter  Name="dest" ControlID="CatPageLabel"/>
                </SelectParameters>
            </asp:SqlDataSource>
        </ItemTemplate>
    </asp:TemplateField>
</Columns>

这就是错误:

Invalid object name '@dest'.

谢谢

0 个答案:

没有答案