我们有一个非常定制的“批量编辑”类型的屏幕。Out 用户经常进行更改,然后在进入下一页之前忘记点击保存。我已经尝试过在这里找到的解决方案:[链接] http://www.telerik.com/support/code-library/prevent-losing-batch-editing-changes-on-paging-or-any-other-postback
[链接] http://www.telerik.com/forums/prevent-losing-batch-editing-changes-on-paging-or-any-other-postback
但我最终会遇到像“RecordNumber”这样的错误,它既不是 DataColumn 也不是 DataRelation。这是我的代码。我认为我们的网格对于这些简单的解决方案来说太复杂了......?
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="AssignTeacherAdvisor2.aspx.cs" Inherits="AssignTeacherAdvisor2" Theme="LBL" %>
<%@ Register Src="Controls/ActionBar.ascx" TagName="ActionBar" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMainAppTop" runat="Server">
<div id="populateTchrIDs" runat="server">
<%-- <script type="text/javascript" language="javascript">
function KGCalChange(sender, eventArgs) {
//debugger;
if (sender.value == "KG") {
showHideLayer('<%= labelKGCal_Search.ClientID %>', 'show');
showHideLayer('<%= comboKGCal_Search.ClientID %>', 'show');
}
else {
showHideLayer('<%= labelKGCal_Search.ClientID %>', 'hide');
showHideLayer('<%= comboKGCal_Search.ClientID %>', 'hide');
}
}
</script>--%>
<script type="text/javascript">
function clientItemChecking(sender, args)
{
if (sender.get_checkedItems().length == 3 && (args.get_item().get_checked() == false))
{
alert("count exceeded");
args.set_cancel(true);
}
}
function clientItemCheckingC(sender, args) {
if (sender.get_checkedItems().length == 5 && (args.get_item().get_checked() == false)) {
alert("count exceeded");
args.set_cancel(true);
}
}
</script>
</div>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<uc1:ActionBar ID="ActionBarTop" runat="server" CancelVisible="True" ExportVisible="True"
SaveVisible="True" Text="Assign Teacher/Advisor" HelpVisible="True" ExportURL="~/DataExport.aspx?frm=AssignTeacherAdvisor2"
OnSaveClick="ActionBar_SaveClick" OnCancelClick="ActionBar_CancelClick" />
<table class="six" style="width: 100%">
<tr>
<td>
<div class="padded header">
Search and Sort
</div>
</td>
<td align="right">
<asp:HyperLink ID="HyperLinkAdvancedSearch" runat="server" NavigateUrl="javascript:ToggleAdvanced();"
class="advancedSearchLink">
Advanced Search</asp:HyperLink>
</td>
</tr>
</table>
<br />
<asp:HiddenField ID="hiddenField" runat="server" />
<asp:Panel ID="PanelSaveSuccess" runat="server" CssClass="infoMessage" Visible="false">
<asp:Label ID="LabelSaveSuccess" runat="server" Text="Information saved successfully." />
</asp:Panel>
<asp:ValidationSummary ID="ValidationSummaryMain" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server" Display="None" ErrorMessage="CustomValidator"></asp:CustomValidator>
<asp:Panel ID="PanelInputs" runat="server" DefaultButton="WebButtonSearch">
<table class="eight" style="width: 100%">
<tr><td colspan = "8" style="text-align: right;">
<sis:InputLabel ID="lblRunReport" runat="server" Text="Report:" Visible="False" />
<telerik:RadComboBox ID="ddlRunReport" runat="server" Width="160px" Visible="False" AutoPostBack="True" OnSelectedIndexChanged="RadComboBoxReport_SelectedIndexChanged">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
<td>
<sis:WebButton ID="wbtnRunReport" runat="server" CausesValidation="true" ImageUrl="~/App_Themes/LBL/wbtnRunReport.gif"
AutoTipKey="Run Report" UseCssHover="True" OnClick="wbtnRunReport_Click" Visible="False" />
</td></tr>
<tr>
<td class="start">
<sis:InputLabel ID="lblLastName_Search" runat="server" Text="Last Name:" />
</td>
<td class="start data">
<telerik:RadTextBox ID="txtLastName_Search" runat="server">
</telerik:RadTextBox>
</td>
<td class="start">
<sis:InputLabel ID="lblFirstName_Search" runat="server" Text="First Name:" />
</td>
<td class="start data">
<telerik:RadTextBox ID="txtFirstName_Search" runat="server">
</telerik:RadTextBox>
</td>
<td class="start">
<sis:InputLabel ID="lblGrades_Search" runat="server" Text="Grade Level:"></sis:InputLabel>
</td>
<td>
<telerik:RadComboBox ID="lstGrades_Search" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Width ="100px" ></telerik:RadComboBox>
<asp:Literal ID="Literal3" runat="server" />
</td>
<td class="end">
<sis:InputLabel ID="lblTeacherAssigned_Search" runat="server" Text="Teacher Assigned:" />
</td>
<td class="end data">
<telerik:RadComboBox ID="cmbTeacherAssigned_Search" runat="server" Width="75px">
<Items>
<telerik:RadComboBoxItem runat="server" Selected="True" Text=" " />
<telerik:RadComboBoxItem runat="server" Text="Yes" Value="Yes" />
<telerik:RadComboBoxItem runat="server" Text="No" Value="No" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
</table>
<table class="six" style="width: 100%">
<tr>
<td class="start">
<%-- <div id="labelKGCal_Search" runat="server">
<sis:InputLabel ID="lblKGCal_Search" runat="server" Text="KG Calendar:" />
</div>--%>
</td>
<td class="start data">
<%-- <div id="comboKGCal_Search" runat="server" style="width: 301px">
<telerik:RadComboBox ID="cmbKGCal_Search" runat="server" Width="249px" Height="31px">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</div>--%>
</td>
<td class="end">
</td>
<td class="end data">
</td>
</tr>
</table>
<div id="DivAdvancedSearch" class="advancedSearch" runat="server">
<table class="eight" style="width: 100%">
<tr>
<td class="start">
<sis:InputLabel ID="lblCurrentYearTeacher_Search" runat="server" Text="Current Year Teacher/Advisor:"></sis:InputLabel>
</td>
<td>
<telerik:RadComboBox ID="lstCurrentYearTeacher_Search" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="false" Width ="250px" OnClientItemChecking="clientItemCheckingC" ></telerik:RadComboBox>
<asp:Literal ID="Literal1" runat="server" />
</td>
<td class="start">
<sis:InputLabel ID="lblPriorYearTeacher_Search" runat="server" Text="Prior Year Teacher/Advisor:"></sis:InputLabel>
</td>
<td>
<telerik:RadComboBox ID="lstPriorYearTeacher_Search" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="false" Width ="250px" OnClientItemChecking="clientItemCheckingC"></telerik:RadComboBox>
<asp:Literal ID="Literal2" runat="server" />
</td>
<td class="start">
<sis:InputLabel ID="lblGender" runat="server" Text="Gender:"></sis:InputLabel>
</td>
<td class="start data">
<telerik:RadComboBox ID="cmbGender_Search" runat="server" Width="85px">
<Items>
<telerik:RadComboBoxItem runat="server" Selected="True" Text=" " />
<telerik:RadComboBoxItem runat="server" Text="Male" Value="Male" />
<telerik:RadComboBoxItem runat="server" Text="Female" Value="Female" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
<td class="end">
<sis:InputLabel ID="lblRowsToDisplay_Search" runat="server" Text="Rows to Display:" />
</td>
<td class="end data">
<telerik:RadComboBox ID="cmbRowsToDisplay_Search" runat="server" Width="65px">
<Items>
<telerik:RadComboBoxItem runat="server" Text="10" Value="10" />
<telerik:RadComboBoxItem runat="server" Text="20" Value="20" />
<telerik:RadComboBoxItem runat="server" Text="30" Value="30" />
<telerik:RadComboBoxItem runat="server" Text="50" Value="50" />
<telerik:RadComboBoxItem runat="server" Text="100" Value="100" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td class="start">
<sis:InputLabel ID="lblFlags_Search" runat="server" Text="Flags (up to 3):"></sis:InputLabel>
</td>
<td>
<telerik:RadComboBox ID="lstFlags_Search" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="false" Width ="250px" OnClientItemChecking="clientItemChecking"></telerik:RadComboBox>
<asp:Literal ID="itemsClientSide" runat="server" />
</td>
<td class="start">
<sis:InputLabel ID="lblIncludeFlag_Search" runat="server" Text="Include Flag:"></sis:InputLabel>
</td>
<td class="start data">
<telerik:RadComboBox ID="cmbIncludeFlag_Search" runat="server" Width="85px">
<Items>
<telerik:RadComboBoxItem runat="server" Selected="True" Text=" " />
<telerik:RadComboBoxItem runat="server" Text="All Flags" Value="A" />
<telerik:RadComboBoxItem runat="server" Text="One or more" Value="O" />
<telerik:RadComboBoxItem runat="server" Text="None of These" Value="N" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
<td class="start">
<sis:InputLabel ID="InputLabelCY" runat="server" Text="Cohort Year:" />
</td>
<td class="start data" align="left" style="width: 138px">
<telerik:RadComboBox ID="RadComboBoxCY_Search" runat="server" TabIndex="4" Width="100px">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</td>
<td class="end">
</td>
<td class="end data">
</td>
</tr>
</table>
<table style="width: 100%" class="six">
<tr>
<td style="width: 121px" class="start" valign="top">
<sis:InputLabel ID="lblDOBFrom_Search" runat="server" Text="DOB Range - From:"></sis:InputLabel>
</td>
<td style="width: 99px" class="start data" valign="top">
<telerik:RadDatePicker ID="dateDOBFrom_Search" runat="server" Width="100px">
<DateInput InvalidStyleDuration="100">
</DateInput>
</telerik:RadDatePicker>
</td>
<td align="right" style="width: 37px" class="start" valign="top">
<sis:InputLabel ID="lblDOBTo_Search" runat="server" Text="To:"></sis:InputLabel>
</td>
<td align="left" style="width: 113px" class="start data" valign="top">
<telerik:RadDatePicker ID="dateDOBTo_Search" runat="server" Width="100px">
<DateInput InvalidStyleDuration="100">
</DateInput>
</telerik:RadDatePicker>
</td>
<td>
</td>
</tr>
</table>
</div>
<table class="eight" style="width: 100%">
<tr>
<td>
<sis:WebButton ID="WebButtonSearch" runat="server" UseCssHover="true" ImageUrl="~/App_Themes/LBL/wbtnSearch.gif"
AutoTipKey="Search" OnClick="WebButtonSearch_Click" AllowLoadBox="True" />
<sis:WebButton ID="WebButtonReset" runat="server" UseCssHover="true" ImageUrl="~/App_Themes/LBL/wbtnReset.gif"
AutoTipKey="Reset" OnClick="WebButtonReset_Click" />
</td>
</tr>
</table>
<asp:Label ID="lblReturnExceedMax" runat="server" CssClass="ListPageStatus"></asp:Label>
</asp:Panel>
<asp:HiddenField ID="HiddenFieldAdvanced" runat="server" />
<br />
<div class="hr">
<hr />
</div>
<table style="width: 100%">
<tr>
<td align="left" style="width: 90px">
<div id="totals" class="padded header" style="width: 93px">
Students
</div>
</td>
<td align="left">
<sis:WebButton ID="WebButtonTotals" runat="server" ImageUrl="~/App_Themes/LBL/wbtnViewTotals.gif"
AutoTipKey="View totals" OnClick="WebButtonTotals_Click" UseCssHover="true" />
</td>
<td><sis:WebButton ID="WebButtonVerify" runat="server"
ImageUrl="~/App_Themes/LBL/wbtnVerify.gif" AutoTipKey="Verify" onclick="WebButtonVerify_Click"
UseCssHover="True" AlertEnabled="True" AlertIcon="Question"
AlertText="You have requested to verify Teacher/Advisor assignments. Would you like to continue?"
AlertTitle="Verify" /></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<telerik:RadGrid ID="grdResults" runat="server" AutoGenerateColumns="False"
AllowCustomPaging="True" AllowPaging="True" OnNeedDataSource="grdResults_NeedDataSource"
OnItemDataBound="grdResults_ItemDataBound" OnItemEvent="grdResults_ItemEvent"
VirtualItemCount="999999" GroupingEnabled="False" >
<ExportSettings>
<Pdf PaperSize="Letter" FontType="Subset"></Pdf>
<Csv RowDelimiter="NewLine" ColumnDelimiter="Comma"></Csv>
</ExportSettings>
<MasterTableView CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR" Frame="Border"
TableLayout="Auto" CommandItemDisplay="None" DataKeyNames="RecordNumber" VirtualItemCount="999999"
AllowCustomPaging="true" EditMode="InPlace" PagerStyle-Position="TopAndBottom">
<RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
Visible="False">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"
Visible="False" Resizable="False">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="StudentName.FullName" CurrentFilterFunction="NoFilter"
HeaderText="Preferred Name" UniqueName="Name" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Grade" CurrentFilterFunction="NoFilter" HeaderText="Grade"
ReadOnly="true">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="KindergartenCalendar" UniqueName="KGCal" CurrentFilterFunction="NoFilter"
HeaderText="KG Calendar" Display="False" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Current Year Teacher/Advisor" UniqueName="CurrentTchrID"
DataField="CurrentTeacherID" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<telerik:RadComboBox ID="RadComboBoxTeacher" runat="server" Height="350px">
</telerik:RadComboBox>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="NextTeacherID" UniqueName="NextTchrID" CurrentFilterFunction="NoFilter"
HeaderText="Prior Year Teacher/Advisor" ReadOnly="true">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">
</EditColumn>
<PopUpSettings ScrollBars="None" />
</EditFormSettings>
<NoRecordsTemplate>
No Records Returned
</NoRecordsTemplate>
<PagerStyle Position="TopAndBottom" />
</MasterTableView>
<SortingSettings EnableSkinSortStyles="False" />
<ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" ColumnsReorderMethod="Reorder" Resizing-ShowRowIndicatorColumn="False">
<Resizing ResizeGridOnColumnResize="True"
AllowColumnResize="True"></Resizing>
</ClientSettings>
</telerik:RadGrid>
<uc1:ActionBar ID="ActionBarBottom" runat="server" CancelVisible="True" ExportVisible="True"
SaveVisible="True" Text="Assign Teacher/Advisor" HelpVisible="True" ExportURL="~/DataExport.aspx?frm=AssignTeacherAdvisor2"
OnSaveClick="ActionBar_SaveClick" OnCancelClick="ActionBar_CancelClick" />
</telerik:RadAjaxPanel>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderFooter" runat="Server">
</asp:Content>