I recently inherited an application from a contractor for my company and there seems to be an issue with desired output that is returned. In this part of the application the user searches for a group of addresses that they want to print labels for. When the search results are returned the user can either print all labels or select which labels they want to print if they don't want/need to print all the labels.
The issue I'm running into is this, the current page size for the data returned in 300 rows per page. In the one instance that was reported there are a total of 500 records returned and when the user selects to go to the second page (no records selected on the first page) and they scroll down to the bottom of the second page and select the last 4 records to print when the mail merge takes place and the items are displayed to the user it shows 4 numerically sequential items from the first page (i.e. if the last for records are index id's 200 - 204 on the second page it returns the indexes from page 1 with those id's). So rather than grab what was selected it returns the records from the first page with the same index id. Is there anyway around this or to have the index not reset and start at the index of 0 each time a new page is selected?
See below for the code I'm looking into:
(aspx)
(cs)
Any help would be appreciated.
The issue I'm running into is this, the current page size for the data returned in 300 rows per page. In the one instance that was reported there are a total of 500 records returned and when the user selects to go to the second page (no records selected on the first page) and they scroll down to the bottom of the second page and select the last 4 records to print when the mail merge takes place and the items are displayed to the user it shows 4 numerically sequential items from the first page (i.e. if the last for records are index id's 200 - 204 on the second page it returns the indexes from page 1 with those id's). So rather than grab what was selected it returns the records from the first page with the same index id. Is there anyway around this or to have the index not reset and start at the index of 0 each time a new page is selected?
See below for the code I'm looking into:
(aspx)
| <telerik:RadAjaxPanel LoadingPanelID="RadAjaxLoadingPanel1" runat="server" ID="upprint"> |
| <center> |
| <asp:HyperLink runat="server" Visible="false" ID="lnkopen" Text="Printing Complete, Click Here to open the document"></asp:HyperLink> |
| </center> |
| <!--Hidden Panel used for Exporting to Excel, all address information is stored in its own column with the export.--> |
| <telerik:RadGrid PageSize="300" AllowPaging="True" |
| EnableViewState="true" |
| AllowMultiRowSelection="true" |
| ID="rgLabels" |
| OnNeedDataSource="rgLabelsNDS" |
| runat="server" |
| AllowSorting="True" |
| AutoGenerateColumns="False" |
| GridLines="None"> |
| <MasterTableView CommandItemDisplay="Top" DataKeyNames="EventHeaderNumber"> |
| <CommandItemTemplate> |
| <div class="header"> |
| <asp:Button CssClass="Button" runat="server" onclick="PrintLabels" Text="Print Selected Labels" /> <asp:Button ID="Button1" CssClass="Button" runat="server" onclick="PrintAllLabels" Text="Print All Labels" /> |
| </div> |
| </CommandItemTemplate> |
| <Columns> |
| <telerik:GridClientSelectColumn></telerik:GridClientSelectColumn> |
| <telerik:GridHyperLinkColumn Visible="false" DataTextField="CounterId" HeaderText="Counter" UniqueName="column"></telerik:GridHyperLinkColumn> |
| <telerik:GridBoundColumn DataField="CheckNumber" Visible="false" HeaderText="Check #" UniqueName="column1"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="ContactMailToFirstName" HeaderText="First" UniqueName="column11"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="ContactMailToLastName" HeaderText="Last" UniqueName="column12"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EntityMailToEntityName" HeaderText="Company" UniqueName="column112"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EntityMailToAddressStreet1" HeaderText="Add 1" UniqueName="column13"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EntityMailToAddressStreet2" HeaderText="Add 2" UniqueName="column14"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EntityMailToCity" HeaderText="City" UniqueName="column15"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EntityMailToState" HeaderText="State" UniqueName="column16"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EntityMailToPostalCode" HeaderText="Zip" UniqueName="column17"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EntityMailToCountry" HeaderText="Cntry" UniqueName="column18"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EntityId" Visible="true" HeaderText="ID" UniqueName="column19"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EventHeaderNumber" Visible="true" HeaderText="Evt. #" UniqueName="column1944"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="HoldReason" Visible="false" HeaderText="Serial #" UniqueName="column20"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EventProfileName" Visible="false" HeaderText="Exp. Date" UniqueName="column21"></telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings> |
| <Selecting AllowRowSelect="True" /> |
| </ClientSettings> |
| <ExportSettings ExportOnlyData="true" IgnorePaging="true" Csv-FileExtension="csv" Csv-ColumnDelimiter="Tab" OpenInNewWindow="true"></ExportSettings> |
| </telerik:RadGrid> |
| <asp:HiddenField runat="server" ID="hdnsrch" /> |
| </telerik:RadAjaxPanel> |
(cs)
| public void PrintLabels(object sender, EventArgs e) |
| { |
| rbt_vw_EventHeaderProfileRow[] rows = new rbt_vw_EventHeaderProfileRow[rgLabels.SelectedItems.Count]; |
| int i = 0; |
| foreach (GridDataItem item in rgLabels.SelectedItems) |
| { |
| rows[i] = ((rbt_vw_EventHeaderProfileRow[])Session["LabelRows"])[item.ItemIndex]; |
| i++; |
| } |
| PrintLabel lbl = new PrintLabel(); |
| lnkopen.NavigateUrl = lbl.PrintLabels(rows, rdLabelType.SelectedItem.Text.ToLower(), "30"); |
| lnkopen.Visible = true; |
| } |
Any help would be appreciated.
