Can anyone Hello me to interprete this visual Basic code to C# code:
Set the CommandName, CommandArgument on the LinkButton:
<asp:LinkButton ID="Like" runat="server" CommandName="Like" CommandArgument='<%# Eval("ID") %>'>Like(<%# Eval("Like")%>)</asp:LinkButton>
On the Repeater's ItemCommand event, update the database, something like:
If e.CommandName = "Like" Then
Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("yourConnectionString").ConnectionString)
Using comm As New SqlCommand("UPDATE Table SET Like=Like+1 WHERE ID=@ID", conn)
comm.Parameters.AddWithValue("@ID", e.CommandArgument)
conn.Open()
comm.ExecuteNonQuery()
End Using
End Using
Repeater1.DataBind()
End If
Go to the complete details ...