如何为 Telerik rad 网格中的每个网格行添加命令项行?

发布于 2024-11-16 16:43:27 字数 3672 浏览 8 评论 0原文

我有一个常用的拉德网格。我想知道是否可以在行中而不是在列中列出操作按钮。按钮将根据每行而有所不同。 有什么想法吗?

这是我到目前为止所做的实验..但嵌套视图没有成功..

    <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" AutoGenerateColumns="False"
    AllowSorting="True" AllowPaging="True" PageSize="5" GridLines="None" ShowGroupPanel="True">
    <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="id" AllowMultiColumnSorting="True"
        GroupLoadMode="Server">
        <Columns>
            <telerik:GridBoundColumn DataField="ref" HeaderText="Ref" SortExpression="ContactName"
                UniqueName="ContactName">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="title" HeaderText="Title" SortExpression="ContactTitle"
                UniqueName="ContactTitle">
            </telerik:GridBoundColumn>

        </Columns>
        <NestedViewSettings DataSourceID="SqlDataSource2">
            <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="vacancyid" MasterKeyField="id" />
            </ParentTableRelation>
        </NestedViewSettings>
        <NestedViewTemplate>
            <asp:Panel ID="NestedViewPanel" runat="server" CssClass="viewWrap">
                <div class="contactWrap">
                    <fieldset style="padding: 10px;">
                        <legend style="padding: 5px;"><b>Detail info for Customer:&nbsp; &nbsp;</b>
                        </legend>
                        <table>
                            <tbody>
                                <tr>
                                    <td>
                                        <table>
                                            <tbody>
                                                <tr>
                                                    <td>
                                                        location:
                                                    </td>
                                                    <td>
                                                        <asp:Label ID="cityLabel" Text='<%#Bind("locationid") %>' runat="server"></asp:Label>
                                                    </td>
                                                </tr>

                                            </tbody>
                                        </table>
                                    </td>

                                </tr>
                            </tbody>
                        </table>
                    </fieldset>
                </div>
            </asp:Panel>
        </NestedViewTemplate>
    </MasterTableView>
    <PagerStyle Mode="NumericPages"></PagerStyle>
    <ClientSettings AllowDragToGroup="true" />
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource2"
    SelectCommand="select vacancyid, locationid from vacancylocationlocation where vacancyid = @id" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    runat="server">
    <SelectParameters>
        <asp:Parameter Name="id" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" 
    SelectCommand="select id, ref, title from vacancy where id = 1045" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    runat="server"></asp:SqlDataSource>

I have a usual rad grid. I was wondering if I could have a list of action buttons in a row rather than in columns. the buttons will vary based on each rows.
any ideas?

here is what i've experimented so far.. but no success for the nested view..

    <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" AutoGenerateColumns="False"
    AllowSorting="True" AllowPaging="True" PageSize="5" GridLines="None" ShowGroupPanel="True">
    <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="id" AllowMultiColumnSorting="True"
        GroupLoadMode="Server">
        <Columns>
            <telerik:GridBoundColumn DataField="ref" HeaderText="Ref" SortExpression="ContactName"
                UniqueName="ContactName">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="title" HeaderText="Title" SortExpression="ContactTitle"
                UniqueName="ContactTitle">
            </telerik:GridBoundColumn>

        </Columns>
        <NestedViewSettings DataSourceID="SqlDataSource2">
            <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="vacancyid" MasterKeyField="id" />
            </ParentTableRelation>
        </NestedViewSettings>
        <NestedViewTemplate>
            <asp:Panel ID="NestedViewPanel" runat="server" CssClass="viewWrap">
                <div class="contactWrap">
                    <fieldset style="padding: 10px;">
                        <legend style="padding: 5px;"><b>Detail info for Customer:   </b>
                        </legend>
                        <table>
                            <tbody>
                                <tr>
                                    <td>
                                        <table>
                                            <tbody>
                                                <tr>
                                                    <td>
                                                        location:
                                                    </td>
                                                    <td>
                                                        <asp:Label ID="cityLabel" Text='<%#Bind("locationid") %>' runat="server"></asp:Label>
                                                    </td>
                                                </tr>

                                            </tbody>
                                        </table>
                                    </td>

                                </tr>
                            </tbody>
                        </table>
                    </fieldset>
                </div>
            </asp:Panel>
        </NestedViewTemplate>
    </MasterTableView>
    <PagerStyle Mode="NumericPages"></PagerStyle>
    <ClientSettings AllowDragToGroup="true" />
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource2"
    SelectCommand="select vacancyid, locationid from vacancylocationlocation where vacancyid = @id" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    runat="server">
    <SelectParameters>
        <asp:Parameter Name="id" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" 
    SelectCommand="select id, ref, title from vacancy where id = 1045" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    runat="server"></asp:SqlDataSource>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

几味少女 2024-11-23 16:43:27

你说的连续是什么意思?您的意思是所有内容都在一个单元格中吗?您可以使用 GridTemplateColumn 来做到这一点。如果您希望按钮显示为嵌套项目,这意味着您必须点击左侧的下拉图标才能查看更多信息,您可以通过添加 NestedViewTemplate (或类似名称)来放置您想要的任何内容。

HTH。

What do you mean by in a row? Do you mean all in one cell? You can do that by using a GridTemplateColumn. If you want buttons to appear as a nested item, meaning you have to hit the drop down icon on the left to see more info, you can put whatever content you want there by adding a NestedViewTemplate (or similarly named).

HTH.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文