Hi everyone,
i'm stuck on this problem: i create a c# function that take a parameter (id) and uprate a single record in my table, but when i put this function in a button's "onclick" all the record in the table get updated, i don't know how to resolve. Can someone have any suggestion?
Here is my code:
@{ var db = Database.Open("SiteSqlServer"); var selectQueryString = "select * from CWExpl where IsApproved = 0"; } @functions {
public async void myfunction(int wid){
var db = Database.Open("SiteSqlServer"); var insertQuery = "UPDATE CWExpl SET IsApproved = 1 WHERE WikiID = "+wid; db.Execute(insertQuery); } }
<h2>Approvazione Wikis</h2> <table class="table table-striped"> <thead> <tr> <th scope="col">id</th> <th scope="col">Canzone</th> <th scope="col">Testo</th> <th scope="col">Wiki</th> <th scope="col">Immagine</th> <th scope="col">xxx</th> </tr> </thead> <tbody> @foreach (var row in db.Query(selectQueryString)) {
<tr> <td>@row.WikiID</td> <td>@row.SongID</td> <td>@row.Original</td> <td>@row.Explanation</td> <td>@row.Urlimg</td> <td> <button onclick="@{myfunction(@row.WikiID);}">Approva</button></td> </tr>} </tbody> </table>
Tks to all
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.