how do I pass a Id value from a grid row to a asp-route-id value

Hi,

how can I pass a cell value from a datagrid to a button as asp-route-xx parameter?

to receive the value i use:

<script>
        var id;
        function RowSelected(args) {
 id=this.getSelectedRecords()[0]['MarketId'];
}
</script>


but how do I pass the id here?

<button id="edit" class="btn btn-primary" asp-page="./NewMarket" asp-route-id=id>bearbeiten</button>



thanks in advance

Martin

1 Reply 1 reply marked as answer

MS Manivel Sellamuthu Syncfusion Team August 19, 2020 02:54 PM UTC

Hi Martin, 

Greetings from Syncfusion support. 

To achieve your requirement we suggest you to set the id attribute in the button. Please refer the below code example for more information. 

<script> 
    function rowSelected (args) { 
// here we suggest we can set the attribute for the button 
        button.setAttribute("asp-route-id", args['OrderID']) 
    } 
</script> 

Please let us know, if you need further assistance. 

Regards, 
Manivel 


Marked as answer
Loader.
Up arrow icon