Home » FAQ » ASP.NET » Client Side Scripting » How to create dynamic javascripts in server side code based on server side variables?
Here’s and example:
VB.NET
Dim value As String = 'pic1.jpg' Button1.Attributes('onMouseOver') = 'alert( ’' + value + '’);'
C#
string value = 'pic1.jpg'; Button1.Attributes['onMouseOver'] = 'alert( \'' + value + '\');' ;
Platform BlazorASP.NETWinFormsWPF.NET MAUI
Question *
Answer (Optional)
Email (Optional)
Email address is only for further clarification on your FAQ request. It will not be used for any other purpose.
Please leave this field empty.
Share with