This topic is locked

Selected records only - export on the list page

6/27/2025 11:26:26 AM
ASPRunner.NET General questions
S
stefansuba author

How can I configure export on the ASPRunner list page to allow exporting only selected records, instead of exporting all records or just the current page?

img alt

ChatGPT 6/27/2025

To configure export functionality in ASPRunner.NET to allow exporting only selected records, you will need to modify the export settings and possibly add some custom logic to handle the selection of records. Here's a general approach you can follow:

Steps to Enable Export of Selected Records in ASPRunner.NET

  1. Enable Checkboxes for Selection:

    • In your ASPRunner project, go to the list page settings.
    • Find the option to enable checkboxes for row selection. This is typically found in the List or View settings where you can customize the appearance of the list.


  2. Add a Button for Exporting Selected Records:

    • Create a custom button on the list page that will handle the export action. This button will be used to initiate the export of only the selected records.


  3. JavaScript to Gather Selected Records:

    • Use JavaScript to gather the IDs of the selected records when the export button is clicked. You can do this by iterating through the checkboxes and collecting the values (IDs) of the checked checkboxes.

    function getSelectedRecords() {
    var selectedIds = [];
    $('input[name="selection"]:checked').each(function() {
    selectedIds.push($(this).val());
    });
    return selectedIds;
    }

  4. Modify the Export Logic:

    • You need to modify the export function to accept the list of selected IDs. This may involve editing the export script or backend logic to filter the records based on the selected IDs.


  5. Pass Selected IDs to the Export Function:

    • When the export button is clicked, pass the list of selected IDs to the export function. You might need to use AJAX or a form submission to send the selected IDs to the server.

    $('#exportButton').click(function() {
    var selectedIds = getSelectedRecords();
    // You can use AJAX here to send the selectedIds to the server
    // or redirect to an export URL with selectedIds as a query parameter
    });

  6. Server-side Handling of Export:

    • On the server side, modify the export logic to handle the incoming selected IDs and export only those records. You'll typically query the database using these IDs to fetch the specific records for export.


  7. Testing:

    • After implementing these changes, test the export functionality to ensure that only the selected records are exported as expected.



Additional Considerations

  • User Permissions: Ensure that users have the necessary permissions to export records.
  • Validation: Implement any necessary validation to handle scenarios where no records are selected.
  • User Feedback: Provide feedback to the user once the export is completed, such as a success message or download link.

By following these steps, you should be able to configure ASPRunner.NET to allow exporting only selected records from the list page. If you encounter specific issues or need further assistance with the code, feel free to ask!

S
stefansuba author 6/27/2025

The AI generated reply did not work