0

我创建radlistview1包含radlistview2.

<telerik:RadListView ID="RadListView1" runat="server" DataKeyNames="cg_id" DataSourceID="SqlDataSource1">
        <ItemTemplate>
            thong tin loai
            <telerik:RadListView ID="RadListView2" runat="server" DataKeyNames="cg_id" DataSourceID="SqlDataSource2">
        <ItemTemplate>
            <%#Eval("cg_id") %>
        </ItemTemplate>
    </telerik:RadListView>        
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TravelConnectionString %>" SelectCommand="SELECT cg_id, cg_name, cg_size, cg_soluongcay, cg_tongtichluydai FROM Categorys_Group WHERE (cg_id = @id)">
        <SelectParameters>
            <asp:SessionParameter Name="id" SessionField="id" DefaultValue='1' />
        </SelectParameters>
    </asp:SqlDataSource>
        </ItemTemplate>
    </telerik:RadListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TravelConnectionString %>" SelectCommand="SELECT * FROM [Categorys_Group]"></asp:SqlDataSource>

正如你看到的。radlistview2 使用 SqlDataSource2。现在,我想从 radlistview1 (<%#Eval("cg_id") %>) 获取值的 asp:SessionParameter defaultvalue,但它出错了。

<asp:SessionParameter Name="id" SessionField="id" DefaultValue='<%#Eval("cg_id") %>' />

我的目标是使用 2 radlistview。radlistview1包含radlistview2. radlistview2将显示 id 为 got 的数据radlistview1

谁能帮我?

感谢您的阅读。

4

1 回答 1

0

改变你SqlDataSource2

 <asp:SqlDataSource ID="SqlDataSource2" runat="server"  
 ConnectionString="<%$ ConnectionStrings:TravelConnectionString %>"  
 SelectCommand='SELECT cg_id, cg_name, cg_size, cg_soluongcay, cg_tongtichluydai  
                FROM Categorys_Group WHERE (cg_id = <%# Eval("cg_id") %>)' >

此代码将不需要使用sessionParameter.

或者

如果要使用参数,请更改sessionParameterParameter喜欢

<asp:Parameter  DefaultValue='<%# Eval("cg_id") %>)' Type="Int32" Name="id"/>

祝你好运 :)

于 2013-07-30T09:33:14.930 回答