Page 1 of 1

Page_load event on click

Posted: Mon Feb 05, 2024 3:03 am
by mpol_ch

Hi,

I need an button on list page to click for sync a table.
Is there an example to have a look into?

I should not select any row to carry out the action...
Onclick it should run the sql query...

  function Page_Load() {
    $this->CustomActions["syncdata"] = new ListAction("syncdata", "<b><font color='green'> Sync Data</font></b>"); // Create custom action

$action = Get("action"); // Get the value of the "action" parameter

   if ($action == "syncdata") { // Check if the action name is "monatsimport"
  $myField = ExecuteStatement("REPLACE INTO Scoredtab SELECT * FROM ScorredSupplier_View"); // Run the SQL command to replace records in Scoredtab with the result of SELECT query
   }
}

mpol_ch


Re: Page_load event on click

Posted: Mon Feb 05, 2024 9:42 am
by arbei

You may read Page_Load -> Example 3 in docs and update your code accordingly.