我有一个包含某些行和列的表。我需要使用Dataset来数据绑定Telerik RadGrid。除此之外,我需要在结尾处显示额外的按钮列。我怎样才能做到这一点?能否请您在aspx和Databind中为我提供Telerik标签的简单示例。
答案 0 :(得分:2)
我在我的应用中使用它。您需要在RadGrid中添加MasterTableView并定义按钮。
<MasterTableView
AllowPaging="true"
PageSize="15"
DataKeyNames="ID"
EditMode="PopUp"
CommandItemDisplay="Top"
AllowFilteringByColumn="false">
<Columns>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="ID" HeaderText="ID" Display="false"/>
<telerik:GridBoundColumn DataField="DOKUMENT_DANEID" HeaderText="DOKUMENT_DANEID" Display="false"/>
<telerik:GridBoundColumn DataField="DOKUMENT_TYPEID" HeaderText="DOKUMENT_DANEID" Display="false"/>
<telerik:GridBoundColumn DataField="NAME" HeaderText="<%$Resources:Resource, grid_dok_name %>"/>
<telerik:GridBoundColumn DataField="TYPe" HeaderText="<%$Resources:Resource, grid_dok_type %>"/>
<telerik:GridBoundColumn DataField="DESC" HeaderText="<%$Resources:Resource, grid_dok_desc %>"/>
<telerik:GridBoundColumn DataField="PATH" HeaderText="<%$Resources:Resource, grid_dok_plik %>"/>
<telerik:GridButtonColumn DataTextFormatString="Select {0}"
ButtonType="ImageButton" HeaderText="<%$Resources:Resource, grid_dok_atta %>"
ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
DataTextField="Open" CommandName="Select" ImageUrl="~\images\App\download.png">
</telerik:GridButtonColumn>
<telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" CommandName="Delete">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings UserControlName="../forms/dok_item.ascx" PopUpSettings-Width="380px" EditFormType="WebUserControl">
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
</EditFormSettings>
</MasterTableView>
答案 1 :(得分:1)
您可以关注telerik文档Buttom Column有许多示例如何使用telerik控件。
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server">
...
<MasterTableView DataSourceID="ProductsDataSource" TableLayout="Auto">
...
<Columns>
<telerik:GridBoundColumn DataField="ProductID" DataType="System.Int32" HeaderText="Product ID"
SortExpression="ProductID" UniqueName="ProductID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProductName" HeaderText="Product Name" SortExpression="ProductName"
UniqueName="ProductName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal" HeaderText="Unit Price"
SortExpression="UnitPrice" UniqueName="UnitPrice">
</telerik:GridBoundColumn>
</Columns>
...
</MasterTableView>
</telerik:RadGrid>