Telerik RadGrid问题:没有选择的项目显示在Buttonclick上,虽然很少的项目被选中



我在aspx页面上有两个RadGrid,并使用一个搜索文本框从RadGrid中搜索项目。有一个按钮,点击这个按钮,选择的项目将被转移到其他网格。

问题是当我用特定的关键字搜索项目,然后从RadGrid中选择项目并单击按钮。没有执行任何操作,并且在代码中没有显示选择的数据项。然后,如果我再次从搜索列表中选择并单击按钮,它会正常工作。

   function requestStart(sender, args) {
        if (args.get_eventTarget().indexOf("ButtonPrint") > 0 
            ||
            args.get_eventTarget().indexOf("ButtonSelect") > 0
            )
            args.set_enableAjax(false);
    }

      <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="EnrollmentPanel">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="EnrollmentPanel"      LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
       <telerik:AjaxSetting AjaxControlID="ButtonEnroll">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManagerProxy>
      <telerik:RadGrid ID="EnrollmentGrid" runat="server" Width="100%" GridLines="None"
            AllowPaging="True" ShowStatusBar="true" AutoGenerateColumns="false" DataSourceID="CourseCreditDS"
            OnItemCommand="EnrollmentGrid_ItemCommand" OnItemDataBound="EnrollmentGrid_ItemDataBound">
            <MasterTableView DataKeyNames="pid" CommandItemDisplay="None">
                <Columns>
                    <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="20px" />
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" EditText="<%$ Resources: Manager, EditCredit %>"
                        Visible="false" />

                    <telerik:GridTemplateColumn UniqueName="AssignedColumn" Visible="false" HeaderStyle-Width="60px">
                        <ItemTemplate>
                            <asp:Image runat="server" ImageUrl="~/Contents/Images/tick.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolled %>" Visible='<%# Eval("enrolled").ToString() == "Y" %>' />
                            <asp:Image runat="server" ImageUrl="~/Contents/Images/error.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolledOther %>" Visible='<%# Eval("already_assigned").ToString() == "Y" %>' />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, StudentId %>" DataTextField="pid"
                        DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
                        SortExpression="pid" Target="_blank" />
                    <telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, Name %>" DataTextField="name"
                        DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
                        SortExpression="lname" Target="_blank" />
                    <telerik:GridBoundColumn HeaderText="<%$ Resources: Manager, Division %>" DataField="div_name"
                        SortExpression="div_name" />
                    <telerik:GridTemplateColumn UniqueName="ResultColumn" HeaderText="<%$ Resources: Manager, Result %>"
                        Visible="false">
                        <ItemTemplate>
                            <asp:Literal ID="ResultText" runat="server" Text="<%$ Resources: Manager, EmptyDataText %>" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn UniqueName="CapIdColumn" HeaderText="<%$ Resources: Manager, CapId %>"
                        DataField="ot1" SortExpression="ot1" ConvertEmptyStringToNull="true" EmptyDataText="<%$ Resources: Manager, EmptyDataText %>"
                        Visible="false" />
                    <telerik:GridTemplateColumn UniqueName="AttachColumn" Visible="false" HeaderText="Attachment">
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td>
                                        <telerik:RadAsyncUpload ID="CCFileUploader"    runat="server" PostbackTriggers="btnUploadPost" OnFileUploaded="CCFileUploader_FileUploaded" OnClientFileUploaded="CCFileUploader_ClientFileUploaded" UploadedFilesRendering="BelowFileInput" />
                                    </td>
                                    <td>
                                        <asp:Button ID="btnUploadPost" runat="server" CausesValidation="false" Text="hidden" Style="display: none" /></td>
                                    <td>
                                        <asp:LinkButton ID="CCExistingUploadsLink" runat="server" Text="<%$ Resources: Manager, NoExistingAttachments %>" Enabled="false" Style="text-decoration: none; color: #769e1a;" />
                                        <asp:HiddenField ID="CCPid" runat="server" Visible="false" Value='<%# Eval("pid")%>' />
                                    </td>
                                </tr>
                            </table>

                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <EditItemStyle CssClass="EditedItem" />
                <EditFormSettings UserControlName="~/Courses/Template/CourseCredit.ascx" EditFormType="WebUserControl">
                    <FormStyle BackColor="White" />
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings>
                <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
            </ClientSettings>
            <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
                <Pdf PageHeight="297mm" PageWidth="210mm" PageTitle="Training Session" />
            </ExportSettings>
        </telerik:RadGrid>

          <telerik:RadGrid ID="EnrollListGrid" runat="server" Width="100%" GridLines="None" AllowPaging="true" PageSize="10" ShowStatusBar="true" AllowMultiRowSelection="true" AutoGenerateColumns="false" OnDetailTableDataBind="EnrollListGrid_DetailTableDatabind"
            OnNeedDataSource="EnrollListGrid_OnNeedDataSource" OnPreRender="EnrollListGrid_OnPreRender">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <MasterTableView AllowMultiColumnSorting="true" DataKeyNames="listname">
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="pid" Name="DetailList">
                        <Columns>
                            <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="20px">
                                <HeaderStyle Width="20px" />
                            </telerik:GridClientSelectColumn>
                            <telerik:GridTemplateColumn UniqueName="AssignedColumn" Visible="false" HeaderStyle-Width="60px">
                                <ItemTemplate>
                                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Contents/Images/tick.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolled %>" Visible='<%# Eval("enrolled").ToString() == "Y" %>' />
                                    <asp:Image ID="Image2" runat="server" ImageUrl="~/Contents/Images/error.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolledOther %>" Visible='<%# Eval("already_assigned").ToString() == "Y" %>' />
                                </ItemTemplate>
                                <HeaderStyle Width="60px" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, StudentId %>" DataTextField="pid"
                                DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
                                SortExpression="pid" Target="_blank" />
                            <telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, Name %>" DataTextField="name"
                                DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
                                SortExpression="lname" Target="_blank" />
                            <telerik:GridBoundColumn HeaderText="<%$ Resources: Manager, Division %>" DataField="div_name"
                                SortExpression="div_name" />
                            <telerik:GridBoundColumn UniqueName="CapIdColumn" HeaderText="<%$ Resources: Manager, CapId %>"
                                DataField="ot1" SortExpression="ot1" ConvertEmptyStringToNull="true" EmptyDataText="<%$ Resources: Manager, EmptyDataText %>" />
                        </Columns>

                        <EditItemStyle CssClass="EditedItem" />
                        <EditFormSettings UserControlName="~/Courses/Template/CourseCredit.ascx" EditFormType="WebUserControl">
                            <FormStyle BackColor="White" />
                        </EditFormSettings>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <%--<telerik:GridClientSelectColumn UniqueName="ClientSelectList" ></telerik:GridClientSelectColumn>--%>
                    <%--<telerik:GridBoundColumn UniqueName="EnrollListID" HeaderText="Enroll List ID" DataField="listid"></telerik:GridBoundColumn>--%>
                    <%--<telerik:GridEditCommandColumn UniqueName="ViewListItems" EditText="View List Items"  ></telerik:GridEditCommandColumn>--%>
                    <telerik:GridBoundColumn UniqueName="EnrollListName" HeaderText="Enroll List Name" DataField="listname"></telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings EnablePostBackOnRowClick="true">
                <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
                <%--<ClientEvents OnRowSelecting="EnrollListGrid_OnRowSelecting" />--%>
            </ClientSettings>
        </telerik:RadGrid>

如果你需要

后面的代码,请告诉我

尝试将绑定的源(我认为是过滤后的网格)ajax到绑定的目标(第二个网格)。

<telerik:AjaxSetting AjaxControlID="EnrollmentGrid">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="EnrollListGrid" />
    </UpdatedControls>
</telerik:AjaxSetting>

如果有帮助,请告诉我。否则,我真的需要一个更简单的工作版本的代码…

相关内容

  • 没有找到相关文章

最新更新