如何为 Telerik rad 网格中的每个网格行添加命令项行?
我有一个常用的拉德网格。我想知道是否可以在行中而不是在列中列出操作按钮。按钮将根据每行而有所不同。 有什么想法吗?
这是我到目前为止所做的实验..但嵌套视图没有成功..
<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>
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你说的连续是什么意思?您的意思是所有内容都在一个单元格中吗?您可以使用 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.