我在批量编辑模式下使用telerik RadGrid。请建议在批量编辑模式下将工具提示提供给RadGrid的“保存更改”按钮,“取消更改按钮”等默认按钮。
答案 0 :(得分:0)
默认情况下,它们有标题:http://screencast.com/t/mdCTqocCK
无论如何,您可以使用自己的控件使用所需的工具提示制作自己的自定义标题:http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/commanditem/command-item-template#custom-commanditemtemplate-for-batch-edit-mode
在有人报告此内容之前,只有链接 - 这是文章
中的代码段<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True"
AllowAutomaticInserts="True" PageSize="10" AllowAutomaticUpdates="True" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ProductID"
DataSourceID="SqlDataSource1" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
<CommandItemTemplate>
<telerik:RadPushButton runat="server" ID="AddNewRecordButton" OnClientClicked="addRecordToGrid" AutoPostBack="false" Text="Add new record" ToolTip="Add new record">
<Icon CssClass="rgAddIcon" />
</telerik:RadPushButton>
<telerik:RadPushButton runat="server" ID="SaveChangesButton" OnClientClicked="saveChangesToGrid" AutoPostBack="false" Text="Save changes" ToolTip="Save changes">
<Icon CssClass="rgSaveIcon" />
</telerik:RadPushButton>
<telerik:RadPushButton runat="server" ID="CancelChangesButton" OnClientClicked="cancelChangesToGrid" AutoPostBack="false" Text="Cancel changes" ToolTip="Cancel changes">
<Icon CssClass="rgCancelIcon" />
</telerik:RadPushButton>
<telerik:RadPushButton runat="server" ID="RefreshButton" OnClientClicked="refreshGrid" AutoPostBack="false" Text="Refresh" ToolTip="Refresh">
<Icon CssClass="rgRefreshIcon" />
</telerik:RadPushButton>
</CommandItemTemplate>
<BatchEditingSettings EditType="Cell" />
</MasterTableView>
</telerik:RadGrid>
和示例脚本
function addRecordToGrid() {
var grid = $find('<%=RadGrid1.ClientID%>');
grid.get_batchEditingManager().addNewRecord(grid.get_masterTableView());
return false;
}
function saveChangesToGrid() {
var grid = $find('<%=RadGrid1.ClientID%>');
grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());
return false;
}
function cancelChangesToGrid() {
var grid = $find('<%=RadGrid1.ClientID%>');
grid.get_batchEditingManager().cancelChanges(grid.get_masterTableView());
return false;
}
function refreshGrid() {
var grid = $find('<%=RadGrid1.ClientID%>');
grid.get_masterTableView().rebind();
}